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

Nouns appearing as options in multiple choice questions are evaluated when displaying MCQ choices #1189

Open
mrseanman opened this issue May 13, 2024 · 4 comments
Milestone

Comments

@mrseanman
Copy link

mrseanman commented May 13, 2024

STACK evaluates all nouns when displaying multiple choice question (MCQ) options. My use case is specifically the noun 'diff, so I will concentrate on that.
When 'diff is part of a choice in a MCQ, it is evaluated before the tex to display the option is generated. This is a problem when you want to display things like 'diff(f,x) as options in an MCQ. Instead of displaying the derivative, it evaluates and displays 0. Specific to diff, declaring depends(f,x) makes no difference to the display of 'diff(f,x) or diff(f,x). The non-action of depends is probably a completely different issue (or intended behavior). I intend to concentrate on the noun issue.

This problem forces the use of diff(f(x),x) in MCQs, which would be nice to avoid as this does not typeset as neatly. Also you cannot have, for example 'diff(x^2,x) as an option in an MCQ. It would display as $2x$.

Minimal example

Question variables

depends(f, x);
disp1: 'diff(f,x);
disp2: diff(f,x);

MCQ: [
   [disp1, true],
    /* using the display option makes no difference */
   [2, false, disp2]
];

Question text

These both (correctly) display as \(\frac{\mathrm{d}f}{\mathrm{d}x}\): {@disp1@}, {@disp2@}.
But the MCQ options are both displayed as 0.
[[input:ans1]] [[validation:ans1]]

Notes

  • Strangely, if we select the first option, at the PRT, ans1 is [diff(f,x)], not [0]. So it is to do with whatever happens when the tex is generated. The noun is still in there somewhere.
  • Use of noundiff makes no difference.
  • This behavior is similar for checkbox and radio questions.
@mrseanman mrseanman changed the title Noun version of diff in multiple choice question is evaluated when displaying choices Nouns appearing as options in multiple choice questions are evaluated when displaying MCQ choices May 14, 2024
@mrseanman
Copy link
Author

This problem appears to extend to all nouns, so have edited title and body text accordingly.

@sangwinc
Copy link
Member

Thanks for reporting this. We did have a problem in the past, and I'm sorry about that.

The logic noun issue ("all nouns" you mention) has a test case which passes and is here
https://github.com/maths/moodle-qtype_stack/blob/master/tests/input_checkbox_test.php#L324

I've tested your example in the "dev" branch (soon to be 4.6.0) and can't reproduce the problem.

Which version are you using? (see https://docs.stack-assessment.org/en/Authoring/Author_FAQ/ )

@mrseanman
Copy link
Author

Thanks for the quick response. The version on my server appears to be 2023060500.

sangwinc added a commit that referenced this issue May 15, 2024
@sangwinc
Copy link
Member

I've investigated this further. The display issue is working, but there is another noun-related issue which I'll try to fix in a future release.

@sangwinc sangwinc added this to the 4.7.0 milestone May 15, 2024
@sangwinc sangwinc modified the milestones: 4.7.0, 4.8.0 Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants