precision-sustainable-ag / Craft-Management

0 stars 0 forks source link

Duplicate form #41

Open saseehav opened 1 month ago

saseehav commented 1 month ago

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.

saseehav commented 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.

saseehav commented 3 weeks ago

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:

  1. When submitting fertility names, couldn't find the fertility in the table on the Kobo Dashboard
  2. After submitting the second form (First time selecting Duplicate this form) - the second email confirmation is incorrect with the updates. It looks like the first / original submission
  3. Can't find the second submission, the duplication, in Kobo.
  4. The duplication appears that it has been submitted by "test_psa"... and then the user is editing that. Is that work flow going to work?
  5. The duplication did NOT update the subplot and the edited text field to the current edit. I got a new confirmation ID with a new submission ID. It made a copy and did not edit it. This is because the Duplicate function triggers a Webhook submission on hitting Duplicate and not the next submission.

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:

saseehav commented 3 weeks ago

current work flow:

saseehav commented 1 week ago

Final Duplication Flow:

Problem we had to solve with thankyou / url:

Other problems:

saseehav commented 1 week ago

adding new: continue editing button in our form confirmation.