You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1019 changed the handling of Popup when the correct answer is a "non-negative integer" and where it was intended (as was the case until WW 2.19) to be the correct answer from the list of answers and not be interpreted as an index. The rationale behind the change is in #1017.
This change can break existing problems in 2 manners when a server is upgraded to WW/PG 2.19:
The answer is too big to be an index of the list of answers, in which case the problem will not load and will report ERRORS from evaluating PG file: The correct answer index is outside the range of choices provided
The index will point to a different element in the array of options, so WW 2.19 would incorrectly grade the popup.
Case 1 - a loading error would occur for: $popupNumRows = PopUp(["?", "3", "4", "5"], "4");
Case 2 - an incorrect answer is treated as correct would occur for: $popupNumRows = PopUp(["?", "3", "4", "5"], "3");
The new code allows setting noindex=>1 to get the old behavior (or changing to use an index to the correct answer). One of these changes needs to be made in any problem which would break due to the change.
Locating all such issues can be potentially time consuming. It may be helpful for administrators to consider temporarily changing the default to be the old behavior on their server for backwards compatibility. However, in the long run - that will also lead to problems, both with needed to maintain the override and as new problems which expect the new default behavior are created.
Using a modified version of macros/parsers/parserPopUp.pl can be a helpful technique to locate problems which probably needed editing. The change will trigger a warning for any problem which may be affected by the issue (false alarms will occur when the question intended the "answer" as an index). Hopefully, staff or students will quickly bring attention to the relevant problems which can then be fixed. The warning will no longer be issued once noindex is set explicitly for all the relevant Popups in a question.
diff --git a/macros/parsers/parserPopUp.pl b/macros/parsers/parserPopUp.pl
index 8e67664a..e1f4d396 100644
--- a/macros/parsers/parserPopUp.pl
+++ b/macros/parsers/parserPopUp.pl
@@ -232,7 +232,8 @@ sub new {
placeholder => $options{placeholder} // '',
showInStatic => $options{showInStatic} // 1,
values => $options{values} // [],
- noindex => $options{noindex} // 0
+ hadNoIndex => ( defined($options{noindex}) ? 1 : 0 ), # Temporary code to help detect issues with integer answers
+ noindex => $options{noindex} // 1 # Default changed temporarily to 1 - old behavior
}, $class;
$self->getChoiceOrder;
$self->addLabelsValues;
@@ -294,6 +295,11 @@ sub addLabelsValues {
sub getCorrectChoice {
my $self = shift;
my $label = shift;
+ if ($label =~ m/^\d+$/ && !$self->{hadNoIndex}) {
+ # Temporary code to report where noindex is probably needed - entire if block
+ warn 'Please report this question for review - potential popup issue';
+ }
+
if ($label =~ m/^\d+$/ && !$self->{noindex}) {
$label = ($self->flattenChoices)[$label];
Value::Error("The correct answer index is outside the range of choices provided")
The text was updated successfully, but these errors were encountered:
taniwallach
changed the title
WW 2.19 has a change to Popup which can break existing questions - temporary workaround + technique to help locate problem file to edit
WW 2.19 has a change to Popup which can break existing questions - temporary workaround + technique to help locate problem files to edit
Nov 5, 2024
#1019 changed the handling of Popup when the correct answer is a "non-negative integer" and where it was intended (as was the case until WW 2.19) to be the correct answer from the list of answers and not be interpreted as an index. The rationale behind the change is in #1017.
This change can break existing problems in 2 manners when a server is upgraded to WW/PG 2.19:
ERRORS from evaluating PG file: The correct answer index is outside the range of choices provided
Case 1 - a loading error would occur for:
$popupNumRows = PopUp(["?", "3", "4", "5"], "4");
Case 2 - an incorrect answer is treated as correct would occur for:
$popupNumRows = PopUp(["?", "3", "4", "5"], "3");
The new code allows setting
noindex=>1
to get the old behavior (or changing to use an index to the correct answer). One of these changes needs to be made in any problem which would break due to the change.Locating all such issues can be potentially time consuming. It may be helpful for administrators to consider temporarily changing the default to be the old behavior on their server for backwards compatibility. However, in the long run - that will also lead to problems, both with needed to maintain the override and as new problems which expect the new default behavior are created.
Using a modified version of
macros/parsers/parserPopUp.pl
can be a helpful technique to locate problems which probably needed editing. The change will trigger a warning for any problem which may be affected by the issue (false alarms will occur when the question intended the "answer" as an index). Hopefully, staff or students will quickly bring attention to the relevant problems which can then be fixed. The warning will no longer be issued oncenoindex
is set explicitly for all the relevant Popups in a question.The text was updated successfully, but these errors were encountered: