Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library/LoyolaChicago/Precalc/Chap4Sec1/Q52.pg #1171

Open
szhorvat opened this issue Aug 27, 2024 · 2 comments · May be fixed by #1172
Open

Library/LoyolaChicago/Precalc/Chap4Sec1/Q52.pg #1171

szhorvat opened this issue Aug 27, 2024 · 2 comments · May be fixed by #1172

Comments

@szhorvat
Copy link
Contributor

szhorvat commented Aug 27, 2024

Problem Seed: 123456

For the middle popup box, this problem only accepts "?" as the solution. The correct solution is actually "0", just as the solution text states. Something is wrong with the answer verification.

I would appreciate hints on how to fix this in the problem source code.

@dlglin dlglin linked a pull request Aug 27, 2024 that will close this issue
@dlglin
Copy link
Member

dlglin commented Aug 27, 2024

I have submitted #1172 as a fix, which is a wholesale rewrite of the problem.

The underlying issue is that there are two ways to refer to the correct answer in a PopUp: you can enter the literal string for the correct answer as is done in this problem, or you can enter the index of the item in the array of choices. This becomes ambiguous when some of the choices in the PopUp coincide with indices of elements in the array. In such cases the default behaviour is to assume that the correct answer represents an index and not a string matching one of the choices.

In this question $popup3 has "0" listed as the correct answer. Since perl doesn't distinguish between strings and integers PG reads 0 to mean the index of the correct answer, so it sets the correct answer to be the 0th element of the array of choices, which is "?".

To get the desired behaviour here, add the noindex => 1 option to the end of $popup3 (it wouldn't hurt to add it to all of the PopUps). That forces PG to interpret the correct answer as being a string matching one of the choices and not an array index, so it will set "0" as the correct answer instead of the 0th element of the choices array.

@szhorvat
Copy link
Contributor Author

szhorvat commented Aug 28, 2024

Thanks so much for providing both an explanation of how to fix this (which I can use for other similar cases in the future) as well as a very nice rewrite of the problem. I lifted the rewrite just in time before the problem set opened. :-)

A small suggestion I have is to perhaps be explicit in the problem text that the expressions should be dragged to the box. I expect at least some students complaining that they never thought of this. Although there are plenty of UIs like this nowadays that it should be self-explanatory enough ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants