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
{{ message }}
Repository navigation
Proposal: change STACK options to cascading options #993
We plan a text-based (YAML?) question authoring format. I expect users will only need to set options which differ from the default in any text-based authoring system. I don't see a problem with a text-based authoring system without fixing this issue, but this issue confirms the design.
Note to self: changing the site default will need to result in clearing the question compilation cache. Of course we almost never actually change site default options and so this performance hit will not really be a significant issue.
This is particularly useful for options such as the decimal separator proposed in issue #789. When we share questions we almost certainly want to import/export materials using the "default" option. Continental users will not want my questions with a British "." as the decimal separator and the certainly don't want to edit them!
(We had this feature in STACK v1.0 at the start of the century but it got lost, sorry!)
Now if we only had this at the course/category level in Moodle instead of the site level. So that all the electrical engineers could switch to using the j in all questions and everyone else could simply keep i in play. Moodle does not provide a system for that, but I wonder if we could have one of those Moodle "blocks" that one could plug into a course or category, override configuration there and then we could look for those in the hierarchy of the site and pick the values from the nearest one, or from the whole chain.
As to recompiling, that depends on the options themselves. Most of them are just display options and are present in the preamble that gets generated during use, just like setting active the language and seed and thus have no role in the code coming out of the compilation. So simply checking which options get changed will probably save us from doing that. Overall, all options should be clearly defined and classified in some meta-data that can be processed in code so that we know which ones affect specific parts of logic. And I think that we do not currently have any options that would affect the compilation result.
I agree it would be very useful to set non-default options at the course level. I think this is an ideal candidate for another Moodle plugin: "Set plugin options at the course level". It might already exist, but I didn't check! (@timhunt ?)
If we demonstrate its value for STACK by resolving this issue then it might become a higher priority for the Moodle community (including us).
Also note that if this expands to settings related to decimal separators, we will eventually need to provide a way for a student/teacher to check the active settings at the question usage level. At that point, these would not only affect visible things but would also affect what they need to input at a much more complex level than just the i vs. j issue.
I am slightly hesitant to do this. There is a great simplicity in each question having settings that are stored in the question. This means that each questoin is self-contained.
For example, the caching of question defintions in Moodle, which is very important for performance during quiz attempts, relies on this. How would you avoid breaking that?
So, I think we should look at other ways to achieve this requirement: make it easy to ensure that all questions in a quiz are using certain settings.
One alternate way to do that would be to make question bank plugin that implements a bulk action, so you can select a bunch of (stack) questions, and then update certain settings in all of them. That is a simple and self-contained development that satisfies most needs, and is worth having anyway.
The one case this does not solve is where you want a single shared questions in a central location, which is used in different places where you would like it to pick up different default options. How necessary is that?
Basically, Tim's worry about the definition cache becoming unusable is the same worry as mine about compilation results having to be invariant to these settings.
As to performance, if we assume that invariance, then the only real added cost would be the extraction of those settings from the context (hierarchy), and that could be done once a request as all the questions handled in a request are pretty much guaranteed to be in the same scope/context/course/site/category/whatever. Merging that result with the question definition stored question-specific settings is a trivial action and costs basically nothing, i.e. use question level unless question level says "default", in which case pick from the context settings.
At this point, pretty much all the stack options are such that they do not affect the compilation result, i.e., we build a CAS preamble or change the input parsing based on them, but the CAS side bulk that has been compiled stays the same. As an example of one setting that would need to be fixed to ensure that invariance, we have the "default penalty" setting that is currently baked into the compiled PRT function and becomes fixed to the setting's value at compile time. To deal with this, we can simply make the PRT compiler use a variable when it would otherwise use the default and then set that variable's value in the CAS preamble. After all, for us, what matters is that the result of the compilation in the form of the code is invariant to the settings, but it can still evaluate into different things based on those settings as long as those get passed to it separately.
As to that alternative, in the form of bulk updating settings, I am strongly against that. Those settings are something that people set for various reasons, and those reasons are important when one picks something differing from the default. We cannot just randomly overwrite those settings in bulk, as that might cause very complex issues, and reverting those issues is not easy, even if it is possible with the versioned question bank.
We do, however, have a larger problem related to setting values at different times. Imagine that a student answers a question with specific setting values, you change those values, and then you run re-grade to those answers. What happens, then? Do we need to store those setting values into the attempt like we store the seed to ensure that values stay the same after the attempt starts? If we store them like that then we only need to resolve the settings during the attempt start which would cut down some DB activity.
Starting to use the continental comma option, I'm facing the problem of changing this option in numerous questions.
Maybe it's an option, to have a menu like in /question/type/stack/adminui/bulktestindex.php
that changes an option in all questions of a category by adding a new version of the question?
Activity
aharjula commentedon Jul 18, 2023
Now if we only had this at the course/category level in Moodle instead of the site level. So that all the electrical engineers could switch to using the
jin all questions and everyone else could simply keepiin play. Moodle does not provide a system for that, but I wonder if we could have one of those Moodle "blocks" that one could plug into a course or category, override configuration there and then we could look for those in the hierarchy of the site and pick the values from the nearest one, or from the whole chain.As to recompiling, that depends on the options themselves. Most of them are just display options and are present in the preamble that gets generated during use, just like setting active the language and seed and thus have no role in the code coming out of the compilation. So simply checking which options get changed will probably save us from doing that. Overall, all options should be clearly defined and classified in some meta-data that can be processed in code so that we know which ones affect specific parts of logic. And I think that we do not currently have any options that would affect the compilation result.
sangwinc commentedon Jul 18, 2023
Thanks for the clarification on caching Matti.
I agree it would be very useful to set non-default options at the course level. I think this is an ideal candidate for another Moodle plugin: "Set plugin options at the course level". It might already exist, but I didn't check! (@timhunt ?)
If we demonstrate its value for STACK by resolving this issue then it might become a higher priority for the Moodle community (including us).
aharjula commentedon Jul 18, 2023
Also note that if this expands to settings related to decimal separators, we will eventually need to provide a way for a student/teacher to check the active settings at the question usage level. At that point, these would not only affect visible things but would also affect what they need to input at a much more complex level than just the
ivs.jissue.timhunt commentedon Aug 2, 2023
I am slightly hesitant to do this. There is a great simplicity in each question having settings that are stored in the question. This means that each questoin is self-contained.
For example, the caching of question defintions in Moodle, which is very important for performance during quiz attempts, relies on this. How would you avoid breaking that?
So, I think we should look at other ways to achieve this requirement: make it easy to ensure that all questions in a quiz are using certain settings.
One alternate way to do that would be to make question bank plugin that implements a bulk action, so you can select a bunch of (stack) questions, and then update certain settings in all of them. That is a simple and self-contained development that satisfies most needs, and is worth having anyway.
The one case this does not solve is where you want a single shared questions in a central location, which is used in different places where you would like it to pick up different default options. How necessary is that?
aharjula commentedon Aug 3, 2023
Basically, Tim's worry about the definition cache becoming unusable is the same worry as mine about compilation results having to be invariant to these settings.
As to performance, if we assume that invariance, then the only real added cost would be the extraction of those settings from the context (hierarchy), and that could be done once a request as all the questions handled in a request are pretty much guaranteed to be in the same scope/context/course/site/category/whatever. Merging that result with the question definition stored question-specific settings is a trivial action and costs basically nothing, i.e. use question level unless question level says "default", in which case pick from the context settings.
At this point, pretty much all the stack options are such that they do not affect the compilation result, i.e., we build a CAS preamble or change the input parsing based on them, but the CAS side bulk that has been compiled stays the same. As an example of one setting that would need to be fixed to ensure that invariance, we have the "default penalty" setting that is currently baked into the compiled PRT function and becomes fixed to the setting's value at compile time. To deal with this, we can simply make the PRT compiler use a variable when it would otherwise use the default and then set that variable's value in the CAS preamble. After all, for us, what matters is that the result of the compilation in the form of the code is invariant to the settings, but it can still evaluate into different things based on those settings as long as those get passed to it separately.
As to that alternative, in the form of bulk updating settings, I am strongly against that. Those settings are something that people set for various reasons, and those reasons are important when one picks something differing from the default. We cannot just randomly overwrite those settings in bulk, as that might cause very complex issues, and reverting those issues is not easy, even if it is possible with the versioned question bank.
We do, however, have a larger problem related to setting values at different times. Imagine that a student answers a question with specific setting values, you change those values, and then you run re-grade to those answers. What happens, then? Do we need to store those setting values into the attempt like we store the seed to ensure that values stay the same after the attempt starts? If we store them like that then we only need to resolve the settings during the attempt start which would cut down some DB activity.
sangwinc commentedon Aug 17, 2023
Ok, thanks for the comments Tim, Matti. We'll leave things as they are for now.
Bjoern-Ge commentedon Nov 10, 2023
Starting to use the continental comma option, I'm facing the problem of changing this option in numerous questions.
Maybe it's an option, to have a menu like in /question/type/stack/adminui/bulktestindex.php
that changes an option in all questions of a category by adding a new version of the question?