Skip to content

Don't mutate dataViewControl to generate integer based answers

James Jenkinson requested to merge 877-data-view-4-choice-questions into main

About the issue

The problem was coming from a reference mutation to the dataViewControl. As the charts we have require integer based answers, there was a line converted the string based answers (A, B, C) to integers (1, 2, 3), however as this was happening in place, the second time the code would be run, it would try again to convert the values (1, 2, 3), but not be able to find them (coming up with an index of -1, which was then returning the last elment of the list.

About the fix

Instead of mutating the original dataViewControl, I changed it to make a new dataViewControl with integer type answers, and use that to display the graph.

Closes #877 (closed)

Merge request reports

Loading