-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cascade delete of submission step #2302
Fix cascade delete of submission step #2302
Conversation
0d8c6fc
to
244a2d5
Compare
Django requires hashable datatypes in the collector, which list and dict aren't.
And record the formstep data on the submissionstep so that we can fix the display from local data rather than related FK data.
Fixed select_for_update in Submission.remove_sensitive_data
244a2d5
to
32a5570
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, loading the form step from the history on the submission step is only needed if the form is restored from an older version while a user is filling in the form?
For all other purposes, if the submission step has no form_step FK it is not a problem?
|
||
|
||
# Note that this exists because of data loss bug #2135 - when a FormStep is being | ||
# deleted in the form designer (or during import/export), we do not want to destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also happen in import export (I thought it was only deleting the form step or restoring a form from an older version)?
During the export all the form resources are turned to JSON (i don't think anything is being deleted?) and during the import, the form should be new, so there is no submission step data that could be associated with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also happen in import export (I thought it was only deleting the form step or restoring a form from an older version)? During the export all the form resources are turned to JSON (i don't think anything is being deleted?) and during the import, the form should be new, so there is no submission step data that could be associated with it?
I'll have to double check that for exactly which mechanism is in play, but it might be that you're importing over an existing form and updating it that way? The original issue reported it being a problem with imports, though I was able to reproduce with a simplified case of deleting the form step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, when restoring old versions of a form, this flow is hit - there is an existing form instance, which makes you hit this codepath (via https://github.com/open-formulieren/open-forms/blob/master/src/openforms/forms/models/form.py#L434):
https://github.com/open-formulieren/open-forms/blob/stable/1.1.x/src/openforms/forms/utils.py#L126
I'll add a testcase that essentially operates on Form.restore_old_version
to ensure this is also covered by the patch.
edit: no, this applies basically as soon as there is a submission, but you'll typically notice it when looking at completed submissions |
95ae8f4
to
7d1eb9f
Compare
Codecov ReportBase: 92.45% // Head: 92.45% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## stable/1.1.x #2302 +/- ##
================================================
- Coverage 92.45% 92.45% -0.01%
================================================
Files 531 531
Lines 16415 16483 +68
Branches 1471 1491 +20
================================================
+ Hits 15177 15239 +62
- Misses 978 981 +3
- Partials 260 263 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Fixes #2135
This is a bandaid with some nasty code, we definitely need to discuss this properly what it should look like for 2.0. (see #2305)
The gist is: