LimeSurvey: master 076d6d0e
Author | Committer | Branch | Timestamp | Parent |
---|---|---|---|---|
gabrieljenik | GitHub | master | 2020-10-08 11:17 | master 0dab3a85 |
Affected Issues | 16708: php error in statistics view | |||
Changeset | Fixed issue 16708: php error in statistics view (#1616) DiagnosisAccording to the description of the issue we believe to be caused by a combination of errors: 1) When changing the type of a question from a type with subquestions to a type without subquestions (ex: from Array to List), the subquestions are not removed from the DB. The subquestions remain in the table with the old type. 2) Check Integrity processes these "orphan" subquestions making sure they match the parent question's type, without checking if it's actually correct for that type to have subquestions. So, it updates the subquestions while it should remove them. I think both actions should check the question type definition (QuestionType attributes) and, if the 'subquestions' attribute is false, remove the subquestions from the DB. Solution1) Override 'update' method in Question model to delete existing subquestions if the question's type doesn't allow them. 2) Updated saveQuestionData action to avoid saving subquestions if the question's type doesn't allow them (because the subquestions are part the POST if they exist in the original question). 3) Updated common_helper's 'fixSubquestions' (used by check integrity) to do the same as mentioned in point 1. Note that 'fixSubquestions' only processes subquestions where the type is not the same as the parent question. This wasn't modified because of the potential impact in performance, but it means it won't fix subquestions of a wrong type if the parent question has the same type. |
|||
mod - application/controllers/QuestionEditorController.php | Diff File | |||
mod - application/helpers/common_helper.php | Diff File | |||
mod - application/models/Question.php | Diff File |