docassemble icon indicating copy to clipboard operation
docassemble copied to clipboard

Error loading interview question with "list collect: true" as JSON

Open daldwell opened this issue 4 years ago • 1 comments

The following interview results in an error when loading as a JSON representation (using json=1 interview parameter). Is there something that should be done before attempting to JSONify a list collect interview question?

(Note that if you remove the list collect attribute, it seems to work fine, but this is not ideal)

objects:
  - client: DAList.using(there_are_any=True, object_type=Individual)
---
question: |
  What client should be added to the list?
fields:
  - First Name: client[i].name.first
  - Last Name: client[i].name.last
list collect: True
---
question: |
  Are there any more clients?
yesno: client.there_is_another
---
mandatory: True
question: |
  Here is your document, ${ client }.

Error log:

KeyError: 0
Log
Traceback (most recent call last):
  File "/usr/share/docassemble/local3.8/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/docassemble/local3.8/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/share/docassemble/local3.8/lib/python3.8/site-packages/docassemble/webapp/server.py", line 11395, in index
    data.update(interview_status.as_data(user_dict))
  File "/usr/share/docassemble/local3.8/lib/python3.8/site-packages/docassemble/base/parse.py", line 1099, in as_data
    the_field['active'] = self.extras['ok'][field.number]
KeyError: 0

daldwell avatar Sep 28 '21 02:09 daldwell

This bug should be fixed in 1.2.102; let me know if upgrading doesn't fix the issue.

jhpyle avatar Sep 28 '21 14:09 jhpyle

I am closing this issue because there has been no activity, but feel free to reopen if there is still an issue. Thanks!

jhpyle avatar Aug 13 '22 14:08 jhpyle