kompassi
kompassi copied to clipboard
As survey responder I can edit a survey response of my own, provided that it is editable
Store all old versions of form responses for history. Perhaps add a superseded_by: ForeignKey("self")
field that, when filled in, indicates there is a newer version of that response. (Alternative: Create an archive table.)
Audit all uses of Survey.responses
to determine if they should filter by superseded_by__isnull=True
to get active responses. Probably all others should than getting a single response, and listing responses for profile responses view (it should show all versions).
When editing a response that has already been edited, update superseded_by
of all old versions to point to the new one.
When showing an old response in the single response view, clearly indicate it is an old one and provide a link to the most recent one.
Copy dimensions as-is to the new version (or move – do dimensions make sense on historical responses?). New versions of existing responses should not call lift_dimension_values
– the dimensions may have already been edited by the admin. Dimension fields should probably be locked from editing.
Editability of survey response: This should probably be controlled at two levels:
- Locking the responses of whole survey from being edited: Add
are_responses_editable
field or similar onSurvey
. - Locking specific responses from being edited: Add
is_response_locked
or similar toDimensionValue
that, when assigned to a response, blocks said response from being edited by the respondent. (Eg. in a typical workflow, anything else than "new")