Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code with depends on does not update multiple objects at the same time for list collect #811

Open
fkohrt opened this issue Feb 4, 2025 · 0 comments

Comments

@fkohrt
Copy link
Contributor

fkohrt commented Feb 4, 2025

If I have a table displaying a DAList of Things (with properties a and b), I can automatically update b if a changes:

variable name: "test"
data:
  object: Thing
  module: docassemble.base.util
  items:
    - name:
        object: Name
        module: docassemble.base.util
        item:
          text: "First"
      a: 2
      b: 4
      c: 6
    - name:
        object: Name
        module: docassemble.base.util
        item:
          text: "Second"
      a: 2
      b: 4
      c: 6
use objects: objects
---
mandatory: True
code: |
  test.set_object_type(Thing)
  test.there_is_another = False
---
table: test.table
rows: test
columns:
  - A: row_item.a
  - B: row_item.b
edit:
  - a
  - b
---
question: |
  What is A?
fields:
  - A: test[i].a
    datatype: number
---
code: |
  test[i].b = test[i].a
depends on:
  - test[i].a
---
mandatory: True
question: Table
subquestion: |
  ${ test.table }

However, if I use list collect: True to update the property a of multiple objects at the same time, only one b is updated:

variable name: "test"
data:
  object: Thing
  module: docassemble.base.util
  items:
    - name:
        object: Name
        module: docassemble.base.util
        item:
          text: "First"
      a: 2
      b: 4
      c: 6
    - name:
        object: Name
        module: docassemble.base.util
        item:
          text: "Second"
      a: 2
      b: 4
      c: 6
use objects: objects
---
mandatory: True
code: |
  test.set_object_type(Thing)
  test.there_is_another = False
---
table: test.table
rows: test
columns:
  - A: row_item.a
  - B: row_item.b
edit:
  - a
  - b
---
question: |
  What is A?
fields:
  - A: test[i].a
    datatype: number
list collect: True
---
code: |
  test[i].b = test[i].a
depends on:
  - test[i].a
---
mandatory: True
question: Table
subquestion: |
  ${ test.table }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant