Tangerine-Community / Tangerine

Digitize your offline data collection. Create your Forms online with Tangerine Editor, conduct them offline with the Tangerine Android App. All results you collect can be exported as a CSV file, easy for processing in a spreadsheet. Tangerine has been used in over 1 million assessments and surveys in over 60 countries and in 100 languages.
http://www.tangerinecentral.org/
GNU General Public License v3.0
49 stars 29 forks source link

Issue loading crashes after a proposal with a repeatable section has one less, one more, or one different in the middle #3062

Open rjcorwin opened 2 years ago

rjcorwin commented 2 years ago

Current version: v3.20.x Upgraded from: Issue on tablet and/or server:

Expected behavior

After making a proposal on a form response involving a <tangy-inputs-groups>, we may have added one more or one less items in that input groups, we would expect diff output to explain that to us after submitting the proposal.

Actual behavior

After submitting the proposal, the issue fails to load.

Steps to reproduce the behavior

On a Device, create a case and fill out a form response on a form that uses <tangy-input-groups> then upload that data. On the server, find that Case, create an issue on that Form Response you filled out earlier, make a proposal, and on the <tangy-input-groups> section, try either adding or removing a group, then submit the proposal. When the Issue then tries to load it will crash, see console for error. This has to do with the fact that when you add/remove items in a tangy input groups, the variable names change in the form because additional inputs in a tangy inputs group gets appended an enumeration but our diff algorithm doesn't know how to diff it. It doesn't know how to diff it so much that it ends up crashing the loading of an issue.

rjcorwin commented 2 years ago

The diff algorithm gets tripped up.

rjcorwin commented 2 years ago

@evansdianga MVP on this would be to at least not crash and instead of a diff show a message on the proposal that says something like "See proposal for differences". Perhaps we just put this in a try catch for now.