docassemble icon indicating copy to clipboard operation
docassemble copied to clipboard

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

Open fkohrt opened this issue 10 months ago • 1 comments

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 }

fkohrt avatar Feb 04 '25 20:02 fkohrt

I think I was able to fix this in 1.7.6. Sorry for the delay.

jhpyle avatar May 23 '25 13:05 jhpyle

Closing this issue because it was addressed in 1.7.6 but if there are still problems, this issue can be reopened.

jhpyle avatar Aug 11 '25 10:08 jhpyle