-
Notifications
You must be signed in to change notification settings - Fork 1
Data cleaning
In older versions of ORS, there was a bug which would make it possible to have multiple answers, given a question and a user, for the MultiAnswer type. After this has been fixed, a cleaning process was necessary in order to keep just the most recent answer in the system. It is worth mentioning that this bug was not really affecting the overall respondents' user experience during the submission of a questionnaire, but PDF reports, CSVs and the API cleary showed this issue.
Launching the following rake task would do the job of cleaning the extra answers:
bundle exec rake clean:answer_parts[:questionnaire_id]
where :questionnaire_id
is of course the id of the questionnaire you want to clean the answers of.
Optionally, you could also specify the question_id
of the given questionnaire:
bundle exec rake clean:answer_parts[:questionnaire_id,:question_id]
As you can see from the name of the task, the AnswerPart model was the one affected by this bug, meaning that for a given Answer, you would have multiple AnswerParts.