Open saseehav opened 1 month ago
Parent ID needed to inject previous data into all the submissions so that Tina can view all skipped data for each form. Once Kobo triggers webhook, kobo could trigger parent id submission and take data not entered into the json for them.
Work around - add a radio button that says "I want to use previously filled data". Q: can this button appear conditionally when duplicate button is pushed? what do i need to make this appear conditionally?
Dashboard for form viewer....... if parent id doesn't work. which it likely won't to update a submission after it's created.....
Plan A: can replicate the functionality on the Kobo page to edit the submission to insert the previously inserted information Plan B: dashboard for Tina to view stitched together forms Plan C: Growers use kobo to hit the Duplicate button.
More work on form duplication:
So far, Trevor has been able to replicate the same workflow the Kobo has the Duplicate feature on their dashboard.
Discovery Issues on Bugs for Duplicate:
Bug: Create the duplicate, and gave a link to edit the original, and not the duplicate. This causes the time stamp to become weird, that the original now gets a later time stamp and says that it is submitted by test_psa. @trevorjpuckett needs to update which version is edited. Edit the duplicate version and not the original.
How do we fix the contents of the email? @saseehav Change the form. Add a field to flag whether we are dealing with an original or duplicate. Hidden field called "Is duplicate" 0/1
Other current issues:
current work flow:
don't need hidden fields in the form like 'parent id' or 'duplicate'.
After a grower submits a form they receive a confirmation email containing the form id, their email, and links to separately view and duplicate the submission in kobo. per GH #23
When clicking the "Duplicate Submission" this triggers the webhook that there is an edited form submitted.
A new tab opens, with a loading screen from the craft forms api. This requests a new enketo form with the pre-filled fields.
During this time, upon clicking "Duplicate form" A grower immediately receives a second email confirmation that a form is submitted. We are hoping this immediate confirmation email is ignored or not noticed. If it contained the data fields, they would look just like the original submission.
A grower can enter, update, change all fields in the form window, and Submit. (this second submission corresponds with the confirmation email generated immediately when clicking Duplicate Submission.
this work flow has been tested on 4 submission duplications in the test contract. 10/24
next would like to test on tons of attachments
Final Duplication Flow:
Problem we had to solve with thankyou / url:
Other problems:
adding new: continue editing button in our form confirmation.
To create the link to duplicate the form When the Webhook is triggered, send email confirmation. job in source code to pass the data submission to the job. attach the form object to tell which properties are fillable. go through the submission, pull out data in key names. build a new URL with all the defaults added to the survey and opens a new Enketo link with pre-filled data.
needed in each form:
Issue: Repeat sections Cannot pass back data from repeat sections AFTER the FIRST repeat Possible Work around:
To make this work: pass a block of text into a NOTE prior to each REPEAT section. The block of text would appear after the duplicated form was passed back through the duplicate form button in the email. The duplicated repeat text block insert language: "If you already filled this section in a previous form and have NO edits continue to the next section. If you DO have entries to change in this section for this plot, please re-fill the whole section with all relevant entries."
Tried: passing a json object of the repeat section already filled form last form into a text block so they can see what they filled. Fail: json object needed to be passed through in the URL, and there is a 2,000 character limit. So, growers would have to visit their old submission to see the items they filled.