Commit ceb3fd15 authored by Mehmedovski's avatar Mehmedovski
Browse files

Initial commit: KNIGHT adaptivequiz for Moodle 5.0-5.2 (based on upstream...

Initial commit: KNIGHT adaptivequiz for Moodle 5.0-5.2 (based on upstream MOODLE_500, tested with 5.2, KNIGHT customizations)
parents
Moodle Adaptive Test Activity - Project KNIGHT at HFT Stuttgart
==============================================================
This is a fork of the upstream plugin mod_adaptivequiz release 2.6.0dev (2026030101),
compatible with Moodle 5.0, 5.1 and 5.2. You will find the original README below.
The modifications were made during the KNIGHT project (2019–2025), where we used adaptive
quizzes not for assessment but for training/exercises, based on teacher feedback and students'
experiences in CBL-based courses. The features were originally developed for Moodle 4.x; this
version (2.6.0dev-knight, 2026062517) ports them to Moodle 5, an upgrade carried out in 2026.
They encompass the following:
* **Acceptance threshold for partial-credit questions.** A threshold that lets teachers adjust
the point fraction at which a question counts as answered correctly, so existing partial-credit
question pools can be reused for adaptive testing. Configured on the item administration
parameters.
* **Attempt review for students.** Teachers can allow students to review their own attempts (via
the question details tab of the attempt review), so students learn from the teacher feedback on
incorrect responses. Requested by our students.
* **Question-analysis reminder for teachers.** A notification reminding teachers to revisit the
question analysis page — quality assurance that the difficulty levels assigned to questions stay
valid. Its frequency is tied to the number of completed attempts and can be adjusted or turned
off; configured on the item administration parameters.
* **Competency level feedback.** Building on "Show ability measure to students", teachers can
enter a description for each used difficulty level (competency level descriptions), shown as
result-dependent feedback after a completed attempt. Opt-in and available for up to 10 difficulty
levels.
* **Show question difficulty level to students.** The current question's difficulty level can be
shown during the attempt, making the adaptive algorithm more transparent.
* **Immediate feedback during the attempt.** Optional per-question feedback after each answer:
students see whether their answer was correct — for partial-credit questions coloured by whether
it reached the acceptance threshold — together with any feedback defined for the question, and
optionally the correct answer.
The student-facing display options are grouped in an "Information shown to students" section of
the activity settings. A German language pack for the KNIGHT additions is included. All KNIGHT
features are off by default, so the plugin behaves like the upstream version until a teacher
enables them.
___________________________________________________________________________________
# README for the mod_adaptivequiz plugin, release 2.6.0dev (2026030101)
Moodle Adaptive Test Activity
===============================
The Adaptive Test activity enables a teacher to create tests that efficiently measure
the takers' abilities. Adaptive tests are comprised of questions selected from the
question bank that are tagged with a score of their difficulty. The questions are
chosen to match the estimated ability level of the current test-taker. If the
test-taker succeeds on a question, a more challenging question is presented next. If
the test-taker answers a question incorrectly, a less-challenging question is
presented next. This technique will develop into a sequence of questions converging
on the test-taker's effective ability level. The test stops when the test-taker's
ability is determined to the required accuracy.
The Adaptive Test activity uses the ["Practical Adaptive Testing CAT Algorithm" by
B.D. Wright][1] published in *Rasch Measurement Transactions, 1988, 2:2 p.24* and
discussed in John Linacre's ["Computer-Adaptive Testing: A Methodology Whose Time Has
Come."][2] *MESA Memorandum No. 69 (2000)*.
[1]: http://www.rasch.org/rmt/rmt22g.htm
[2]: http://www.rasch.org/memo69.pdf
This Moodle activity module was originally created as a collaborative effort between [Middlebury
College][3] and [Remote Learner][4]. The current repository was forked from
[https://github.com/middlebury/moodle-mod_adaptivequiz][5].
The current branch of the repository is compatible with Moodle 5.0, 5.1 and 5.2.
**<span style="font-size:1.25em">IMPORTANT: the current branch is not an official plugin release for Moodle 5! It is
an alpha and is intended for test sites only. Use the current branch at your own risk for any public Moodle
sites.</span>**
[3]: http://www.middlebury.edu/
[4]: http://remote-learner.net/
[5]: https://github.com/middlebury/moodle-mod_adaptivequiz
The Question Bank
-----------------
To begin with, questions to be used with this activity are added or imported into
Moodle's question bank. Only questions that can automatically be graded may be used.
As well, questions should not award partial credit. The questions can be placed in
one or more categories.
This activity is best suited to determining an ability measure along a unidimensional
scale. While the scale can be very broad, the questions must all provide a measure of
ability or aptitude on the same scale. In a placement test for example, questions low
on the scale that novices are able to answer correctly should also be answerable by
experts, while questions higher on the scale should only be answerable by experts or
a lucky guess. Questions that do not discriminate between takers of different
abilities on will make the test ineffective and may provide inconclusive results.
Take for example a language placement test. Low-difficulty vocabulary and
reading-comprehension questions would likely be answerable by all but the most novice
test-takers. Likewise, high-difficulty questions involving advanced grammatical
constructs and nuanced reading-comprehension would be likely only be correctly
answered by advanced, high-level test-takers. Such questions would all be good
candidates for usage in an Adaptive Test. In contrast, a question like "Is 25¥ a good
price for a sandwich?" would not measure language ability but rather local knowledge
and would be as likely to be answered correctly by a novice speaker who has recently
been to China as it would be answered incorrectly by an advanced speaker who comes
from Taiwan -- where a different currency is used. Such questions should not be
included in the question-pool.
Questions must be tagged with a 'difficulty score' using the format
'adpq\_*n*' where *n* is a positive integer, e.g. 'adpq\_1' or 'adpq\_57'. The range
of the scale is arbitrary (e.g. 1-10, 0-99, 1-1000), but should have enough levels to
distinguish between
question difficulties.
### Moodle 5 updates ###
The current version allows to start operating with entire question banks in Moodle. This means a quiz manager
can link an entire question bank or several question banks to use them as an item bank for the adaptive quiz.
This is the key difference from any previous plugin version where the item bank consisted of linked question
categories. For the upgraded sites however, all question categories linked as an item bank (or 'questions pool')
in previous plugin versions remain linked with no changes. Please note, that quiz managers won't be able to
link more separate question categories in the new plugin version, this is a temporary limitation in the new
item bank management. As a new item bank, only entire question banks can be linked.
The Testing Process
-------------------
The Adaptive Test activity is configured with a fixed starting level. The test will
begin by presenting the test-taker with a random question from that starting level.
As described in [Linacre (2000)][2], it often makes sense to have the starting level
be in the lower part of the difficulty range so that most test-takers get to answer
at least one of the first few questions correctly, helping their moral.
After the test-taker submits their answer, the system calculates the target question
difficulty it will select next. If the last question was answered correctly, the next
question will be harder; if the last question was answered incorrectly, the next
question will be easier. The system also calculates a measure of the test-taker's
ability and the standard error for that measure. A next random question at or near
the target difficulty is selected and presented to the user.
This process of alternating harder questions following correct answers and easier
questions following wrong answers continues until one of the stopping conditions is
met. The possible stopping conditions are as follows:
* There are no remaining easier questions to ask after a wrong answer.
* There are no remaining harder questions to ask after a correct answer.
* The standard error in the measure has become precise enough to stop.
* The maximum number of questions has been exceeded.
Test Parameters and Operation
==============================
The primary parameters for tuning the operation of the test are:
* The starting level
* The minimum number of questions
* The maximum number of questions
* The standard error to stop
Relationship between maximum number of questions and Standard Error
--------------------------------------------------------------------
As discussed in [Wright (1988)][1], the formula for calculating the standard error is
given by:
Standard Error (± logits) = sqrt((R+W)/(R*W))
where `R` is the number of right answers and `W` is the number of wrong answers. This
value is on a [logit](http://en.wikipedia.org/wiki/Logit) scale, so we can apply the
inverse-logit function to convert it to an percentage scale:
Standard Error (± %) = ((1 / ( 1 + e^( -1 * sqrt((R+W)/(R*W)) ) ) ) - 0.5) * 100
Looking at the Standard Error function, it is important to note that it depends only
on the difference between the number of right and wrong answers and the total number
of answers, not on any other features such as which answers were right and which
answers were wrong. For a given number of questions asked, the Standard Error will be
smallest when half the answers are right and half are wrong. From this, we can deduce
the minimum standard error possible to achieve for any number of questions asked:
* 10 questions (5 right, 5 wrong) → Minimum Standard Error = ± 15.30%
* 20 questions (10 right, 10 wrong) → Minimum Standard Error = ± 11.00%
* 30 questions (15 right, 15 wrong) → Minimum Standard Error = ± 9.03%
* 40 questions (20 right, 20 wrong) → Minimum Standard Error = ± 7.84%
* 50 questions (25 right, 25 wrong) → Minimum Standard Error = ± 7.02%
* 60 questions (30 right, 30 wrong) → Minimum Standard Error = ± 6.42%
* 70 questions (35 right, 35 wrong) → Minimum Standard Error = ± 5.95%
* 80 questions (40 right, 40 wrong) → Minimum Standard Error = ± 5.57%
* 90 questions (45 right, 45 wrong) → Minimum Standard Error = ± 5.25%
* 100 questions (50 right, 50 wrong) → Minimum Standard Error = ± 4.98%
* 110 questions (55 right, 55 wrong) → Minimum Standard Error = ± 4.75%
* 120 questions (60 right, 60 wrong) → Minimum Standard Error = ± 4.55%
* 130 questions (65 right, 65 wrong) → Minimum Standard Error = ± 4.37%
* 140 questions (70 right, 70 wrong) → Minimum Standard Error = ± 4.22%
* 150 questions (75 right, 75 wrong) → Minimum Standard Error = ± 4.07%
* 160 questions (80 right, 80 wrong) → Minimum Standard Error = ± 3.94%
* 170 questions (85 right, 85 wrong) → Minimum Standard Error = ± 3.83%
* 180 questions (90 right, 90 wrong) → Minimum Standard Error = ± 3.72%
* 190 questions (95 right, 95 wrong) → Minimum Standard Error = ± 3.62%
* 200 questions (100 right, 100 wrong) → Minimum Standard Error = ± 3.53%
What this listing indicates is that for a test configured with a maximum of 50
questions and a "standard error to stop" of 7%, the maximum number of questions will
always be encountered first and stop the test. Conversely, if you are looking for a
standard error of 5% or better, the test must ask at least 100 questions.
Note that these are best-case scenarios for the number of questions asked. If a
test-taker answers a lopsided run of questions right or wrong the test will require
more questions to reach a target standard of error.
Minimum number of questions
----------------------------
For most purposes this value can be set to `1` since the standard of error to stop
will generally set a base-line for the number of questions required. This could be
configured to be greater than the minimum number of questions needed to achieve the
standard of error to stop if you wish to ensure that all test-takers answer
additional questions.
Starting level
---------------
As mentioned above, this will usually be set in the lower part of the difficulty
range (about 1/3 of the way up from the bottom) so that most test takers will be able
to answer one of the first two questions correctly and get a moral boost from their
correct answers. If the starting level is too high, low-ability users would be asked
several questions they can't answer before the test begins asking them questions at a
level they can answer.
Scoring
========
As discussed in [Wright (1988)][1], the formula for calculating the ability measure is given by:
Ability Measure = H/L + ln(R/W)
where `H` is the sum of all question difficulties answered, `L` is the number of
questions answered, `R` is the number of right answers, and `W` is the number of
wrong answers.
Note that this measure is not affected by the order of answers, just the total
difficulty and number of right and wrong answers. This measure is dependent on the
test algorithm presenting alternating easier/harder questions as the user answers
wrong/right and may not be applicable to other algorithms. In practice, this means
that the ability measure should not be greatly affected by a small number of spurious
right or wrong answers.
As discussed in [Linacre (2000)][2], the ability measure of the test taker aligns
with the question-difficulty at which the test-taker has a 50% probability of
answering a question correctly.
For example, given a test with levels 1-10 and a test-taker that answered every
question 5 and below correctly and every question 6 and up wrong, the test-taker's
ability measure would fall close to 5.5.
Remember that the ability measure does have error associated with it. Be sure to take the standard error amount into account
when acting on the score.
define("mod_adaptivequiz/attempt_administration_chart_dataset_config",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={orderWeights:{ABILITY_MEASURE:10,ADMINISTERED_DIFFICULTY:20,TARGET_DIFFICULTY:30,STANDARD_ERROR_BORDER:40,STANDARD_ERROR_PERCENT:50,CORRECT_WRONG_FLAG:60},indices:{TARGET_DIFFICULTY:0,ADMINISTERED_DIFFICULTY:1,CORRECT_WRONG_FLAG:2,ABILITY_MEASURE:3,STANDARD_ERROR_MAX:4,STANDARD_ERROR_MIN:5,STANDARD_ERROR_PERCENT:6}},_exports.default}));
//# sourceMappingURL=attempt_administration_chart_dataset_config.min.js.map
\ No newline at end of file
{"version":3,"file":"attempt_administration_chart_dataset_config.min.js","sources":["../src/attempt_administration_chart_dataset_config.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Defines order and indices for datasets.\n *\n * @module mod_adaptivequiz/attempt_administration_chart_dataset_config\n * @copyright 2024 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport default {\n orderWeights: {\n ABILITY_MEASURE: 10,\n ADMINISTERED_DIFFICULTY: 20,\n TARGET_DIFFICULTY: 30,\n STANDARD_ERROR_BORDER: 40,\n STANDARD_ERROR_PERCENT: 50,\n CORRECT_WRONG_FLAG: 60,\n },\n indices: {\n TARGET_DIFFICULTY: 0,\n ADMINISTERED_DIFFICULTY: 1,\n CORRECT_WRONG_FLAG: 2,\n ABILITY_MEASURE: 3,\n STANDARD_ERROR_MAX: 4,\n STANDARD_ERROR_MIN: 5,\n STANDARD_ERROR_PERCENT: 6,\n },\n};\n"],"names":["orderWeights","ABILITY_MEASURE","ADMINISTERED_DIFFICULTY","TARGET_DIFFICULTY","STANDARD_ERROR_BORDER","STANDARD_ERROR_PERCENT","CORRECT_WRONG_FLAG","indices","STANDARD_ERROR_MAX","STANDARD_ERROR_MIN"],"mappings":"8MAuBe,CACXA,aAAc,CACVC,gBAAiB,GACjBC,wBAAyB,GACzBC,kBAAmB,GACnBC,sBAAuB,GACvBC,uBAAwB,GACxBC,mBAAoB,IAExBC,QAAS,CACLJ,kBAAmB,EACnBD,wBAAyB,EACzBI,mBAAoB,EACpBL,gBAAiB,EACjBO,mBAAoB,EACpBC,mBAAoB,EACpBJ,uBAAwB"}
\ No newline at end of file
/**
* Customized output for the attempt administration chart.
*
* The class overrides some definitions from core/chart_output_chartjs for custom output.
*
* @module mod_adaptivequiz/attempt_administration_chart_output
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("mod_adaptivequiz/attempt_administration_chart_output",["core/chart_output_chartjs","core/chartjs","mod_adaptivequiz/attempt_administration_chart_dataset_config"],(function(Output,Chartjs,DatasetConfig){const tooltipItemsFilter=function(tooltipItem){return!(tooltipItem.datasetIndex===DatasetConfig.indices.STANDARD_ERROR_MAX||tooltipItem.datasetIndex===DatasetConfig.indices.STANDARD_ERROR_MIN)},afterTooltipItemLabel=function(tooltipItem){if(tooltipItem.datasetIndex!==DatasetConfig.indices.ABILITY_MEASURE&&tooltipItem.datasetIndex!==DatasetConfig.indices.ADMINISTERED_DIFFICULTY)return"";if(tooltipItem.datasetIndex===DatasetConfig.indices.ABILITY_MEASURE){const stdErrorSeries=this._chart.getSeries()[DatasetConfig.indices.STANDARD_ERROR_PERCENT],stdErrorValue=stdErrorSeries.getValues()[tooltipItem.dataIndex];return"".concat(stdErrorSeries.getLabel(),": ").concat(stdErrorValue)}const rightWrongSeries=this._chart.getSeries()[DatasetConfig.indices.CORRECT_WRONG_FLAG],rightWrongValue=rightWrongSeries.getValues()[tooltipItem.dataIndex];return"".concat(rightWrongSeries.getLabel(),": ").concat(rightWrongValue)},legendConfig=function(){return{labels:{generateLabels(chart){let labels=Chartjs.defaults.plugins.legend.labels.generateLabels(chart);const stdErrorLabelText=labels.find((label=>label.datasetIndex===DatasetConfig.indices.STANDARD_ERROR_PERCENT)).text;labels=labels.filter((label=>!label.hidden&&label.datasetIndex!==DatasetConfig.indices.STANDARD_ERROR_MIN)),labels.sort(((label1,label2)=>label1.datasetIndex-label2.datasetIndex));const stdErrorMaxIndex=labels.findIndex((label=>label.datasetIndex===DatasetConfig.indices.STANDARD_ERROR_MAX));return labels[stdErrorMaxIndex].text=stdErrorLabelText,labels[stdErrorMaxIndex].strokeStyle="#ffcce0",labels[stdErrorMaxIndex].fillStyle="#ffcce0",labels}},onClick:function(){return!1}}};function AttemptAdministrationChartOutput(){Output.apply(this,arguments)}return AttemptAdministrationChartOutput.prototype=Object.create(Output.prototype),AttemptAdministrationChartOutput.prototype._makeConfig=function(){let config=Output.prototype._makeConfig.apply(this,arguments);return config.data.datasets[DatasetConfig.indices.ABILITY_MEASURE].order=DatasetConfig.orderWeights.ABILITY_MEASURE,config.data.datasets[DatasetConfig.indices.TARGET_DIFFICULTY].order=DatasetConfig.orderWeights.TARGET_DIFFICULTY,config.data.datasets[DatasetConfig.indices.ADMINISTERED_DIFFICULTY].order=DatasetConfig.orderWeights.ADMINISTERED_DIFFICULTY,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].order=DatasetConfig.orderWeights.STANDARD_ERROR_BORDER,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].order=DatasetConfig.orderWeights.STANDARD_ERROR_BORDER,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].pointStyle=!1,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].pointStyle=!1,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].showLine=!1,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].showLine=!1,config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_PERCENT].hidden=!0,config.data.datasets[DatasetConfig.indices.CORRECT_WRONG_FLAG].hidden=!0,config.options.plugins.tooltip.filter=tooltipItemsFilter,config.options.plugins.tooltip.callbacks.afterLabel=afterTooltipItemLabel.bind(this),config.options.plugins.tooltip.itemSort=function(tooltip1,tooltip2){return tooltip1.datasetIndex-tooltip2.datasetIndex},config.options.plugins.legend=legendConfig(),config},AttemptAdministrationChartOutput}));
//# sourceMappingURL=attempt_administration_chart_output.min.js.map
\ No newline at end of file
{"version":3,"file":"attempt_administration_chart_output.min.js","sources":["../src/attempt_administration_chart_output.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Customized output for the attempt administration chart.\n *\n * The class overrides some definitions from core/chart_output_chartjs for custom output.\n *\n * @module mod_adaptivequiz/attempt_administration_chart_output\n * @copyright 2024 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'core/chart_output_chartjs',\n 'core/chartjs',\n 'mod_adaptivequiz/attempt_administration_chart_dataset_config'\n], function(\n Output,\n Chartjs,\n DatasetConfig\n) {\n\n /**\n * Used to set the color as a hex code to avoid inconsistencies from Chartjs when displaying the color with opacity specified.\n */\n const STANDARD_ERROR_LABEL_COLOR = '#ffcce0';\n\n /**\n * A filter callback for tooltip items.\n *\n * @param {Object} tooltipItem\n * @return {Boolean}\n */\n const tooltipItemsFilter = function (tooltipItem) {\n return !(tooltipItem.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MAX\n || tooltipItem.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MIN);\n };\n\n /**\n * A callback to add text after a tooltip item.\n *\n * @param {Object} tooltipItem\n * @return {String}\n */\n const afterTooltipItemLabel = function (tooltipItem) {\n // Show extra text only after the ability measure and administered difficulty items.\n if (!(tooltipItem.datasetIndex === DatasetConfig.indices.ABILITY_MEASURE\n || tooltipItem.datasetIndex === DatasetConfig.indices.ADMINISTERED_DIFFICULTY)) {\n\n return '';\n }\n\n // If this is the ability measure item.\n if (tooltipItem.datasetIndex === DatasetConfig.indices.ABILITY_MEASURE) {\n // Reach out to the standard error data.\n const stdErrorSeries = this._chart.getSeries()[DatasetConfig.indices.STANDARD_ERROR_PERCENT];\n const stdErrorValue = stdErrorSeries.getValues()[tooltipItem.dataIndex];\n\n return `${stdErrorSeries.getLabel()}: ${stdErrorValue}`;\n }\n\n // The rest case - administered difficulty item.\n\n // Reach out to the right/wrong data.\n const rightWrongSeries = this._chart.getSeries()[DatasetConfig.indices.CORRECT_WRONG_FLAG];\n const rightWrongValue = rightWrongSeries.getValues()[tooltipItem.dataIndex];\n\n return `${rightWrongSeries.getLabel()}: ${rightWrongValue}`;\n };\n\n /**\n * Returns part of the config to set up the legend.\n *\n * @return {Object}\n */\n const legendConfig = function () {\n return {\n labels: {\n generateLabels(chart) {\n let labels = Chartjs.defaults.plugins.legend.labels.generateLabels(chart);\n\n // Store the standard error label for future use.\n const stdErrorLabelText = labels.find((label) =>\n label.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_PERCENT).text;\n\n // Remove everything hidden and one of the standard error labels.\n labels = labels.filter((label) =>\n !label.hidden && label.datasetIndex !== DatasetConfig.indices.STANDARD_ERROR_MIN);\n\n // Order by dataset index.\n labels.sort((label1, label2) => label1.datasetIndex - label2.datasetIndex);\n\n // Convert one of the standard error labels to a proper one.\n const stdErrorMaxIndex = labels.findIndex((label) =>\n label.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MAX);\n labels[stdErrorMaxIndex].text = stdErrorLabelText;\n labels[stdErrorMaxIndex].strokeStyle = STANDARD_ERROR_LABEL_COLOR;\n labels[stdErrorMaxIndex].fillStyle = STANDARD_ERROR_LABEL_COLOR;\n\n return labels;\n }\n },\n onClick: function () {\n return false;\n }\n };\n };\n\n /**\n * Output for the attempt administration chart.\n *\n * @class\n * @extends {module:core/chart_output_chartjs}\n */\n function AttemptAdministrationChartOutput() {\n Output.apply(this, arguments);\n }\n AttemptAdministrationChartOutput.prototype = Object.create(Output.prototype);\n\n /**\n * Overrides config definition to add more custom features.\n *\n * @protected\n * @override\n * @return {Object}\n */\n AttemptAdministrationChartOutput.prototype._makeConfig = function () {\n let config = Output.prototype._makeConfig.apply(this, arguments);\n\n // Define draw order.\n config.data.datasets[DatasetConfig.indices.ABILITY_MEASURE].order = DatasetConfig.orderWeights.ABILITY_MEASURE;\n config.data.datasets[DatasetConfig.indices.TARGET_DIFFICULTY].order = DatasetConfig.orderWeights.TARGET_DIFFICULTY;\n config.data.datasets[DatasetConfig.indices.ADMINISTERED_DIFFICULTY].order =\n DatasetConfig.orderWeights.ADMINISTERED_DIFFICULTY;\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].order = DatasetConfig.orderWeights.STANDARD_ERROR_BORDER;\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].order = DatasetConfig.orderWeights.STANDARD_ERROR_BORDER;\n\n // Hide lines and points for standard error min/max datasets.\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].pointStyle = false;\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].pointStyle = false;\n\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].showLine = false;\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].showLine = false;\n\n // Hide entire datasets with standard error percentages and right/wrong flags.\n config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_PERCENT].hidden = true;\n config.data.datasets[DatasetConfig.indices.CORRECT_WRONG_FLAG].hidden = true;\n\n // Tooltip.\n config.options.plugins.tooltip.filter = tooltipItemsFilter;\n config.options.plugins.tooltip.callbacks.afterLabel = afterTooltipItemLabel.bind(this);\n config.options.plugins.tooltip.itemSort = function (tooltip1, tooltip2) {\n return tooltip1.datasetIndex - tooltip2.datasetIndex;\n };\n\n // Legend.\n config.options.plugins.legend = legendConfig();\n\n return config;\n };\n\n return AttemptAdministrationChartOutput;\n});\n"],"names":["define","Output","Chartjs","DatasetConfig","tooltipItemsFilter","tooltipItem","datasetIndex","indices","STANDARD_ERROR_MAX","STANDARD_ERROR_MIN","afterTooltipItemLabel","ABILITY_MEASURE","ADMINISTERED_DIFFICULTY","stdErrorSeries","this","_chart","getSeries","STANDARD_ERROR_PERCENT","stdErrorValue","getValues","dataIndex","getLabel","rightWrongSeries","CORRECT_WRONG_FLAG","rightWrongValue","legendConfig","labels","generateLabels","chart","defaults","plugins","legend","stdErrorLabelText","find","label","text","filter","hidden","sort","label1","label2","stdErrorMaxIndex","findIndex","strokeStyle","fillStyle","onClick","AttemptAdministrationChartOutput","apply","arguments","prototype","Object","create","_makeConfig","config","data","datasets","order","orderWeights","TARGET_DIFFICULTY","STANDARD_ERROR_BORDER","pointStyle","showLine","options","tooltip","callbacks","afterLabel","bind","itemSort","tooltip1","tooltip2"],"mappings":";;;;;;;;;AAwBAA,8DAAO,CACH,4BACA,eACA,iEACD,SACCC,OACAC,QACAC,qBAcMC,mBAAqB,SAAUC,qBACxBA,YAAYC,eAAiBH,cAAcI,QAAQC,oBACrDH,YAAYC,eAAiBH,cAAcI,QAAQE,qBASxDC,sBAAwB,SAAUL,gBAE9BA,YAAYC,eAAiBH,cAAcI,QAAQI,iBAClDN,YAAYC,eAAiBH,cAAcI,QAAQK,8BAE/C,MAIPP,YAAYC,eAAiBH,cAAcI,QAAQI,gBAAiB,OAE9DE,eAAiBC,KAAKC,OAAOC,YAAYb,cAAcI,QAAQU,wBAC/DC,cAAgBL,eAAeM,YAAYd,YAAYe,2BAEnDP,eAAeQ,wBAAeH,qBAMtCI,iBAAmBR,KAAKC,OAAOC,YAAYb,cAAcI,QAAQgB,oBACjEC,gBAAkBF,iBAAiBH,YAAYd,YAAYe,2BAEvDE,iBAAiBD,wBAAeG,kBAQxCC,aAAe,iBACV,CACHC,OAAQ,CACJC,eAAeC,WACPF,OAASxB,QAAQ2B,SAASC,QAAQC,OAAOL,OAAOC,eAAeC,aAG7DI,kBAAoBN,OAAOO,MAAMC,OACnCA,MAAM5B,eAAiBH,cAAcI,QAAQU,yBAAwBkB,KAGzET,OAASA,OAAOU,QAAQF,QACnBA,MAAMG,QAAUH,MAAM5B,eAAiBH,cAAcI,QAAQE,qBAGlEiB,OAAOY,MAAK,CAACC,OAAQC,SAAWD,OAAOjC,aAAekC,OAAOlC,qBAGvDmC,iBAAmBf,OAAOgB,WAAWR,OACvCA,MAAM5B,eAAiBH,cAAcI,QAAQC,4BACjDkB,OAAOe,kBAAkBN,KAAOH,kBAChCN,OAAOe,kBAAkBE,YAvEN,UAwEnBjB,OAAOe,kBAAkBG,UAxEN,UA0EZlB,SAGfmB,QAAS,kBACE,cAWVC,mCACL7C,OAAO8C,MAAMjC,KAAMkC,kBAEvBF,iCAAiCG,UAAYC,OAAOC,OAAOlD,OAAOgD,WASlEH,iCAAiCG,UAAUG,YAAc,eACjDC,OAASpD,OAAOgD,UAAUG,YAAYL,MAAMjC,KAAMkC,kBAGtDK,OAAOC,KAAKC,SAASpD,cAAcI,QAAQI,iBAAiB6C,MAAQrD,cAAcsD,aAAa9C,gBAC/F0C,OAAOC,KAAKC,SAASpD,cAAcI,QAAQmD,mBAAmBF,MAAQrD,cAAcsD,aAAaC,kBACjGL,OAAOC,KAAKC,SAASpD,cAAcI,QAAQK,yBAAyB4C,MAChErD,cAAcsD,aAAa7C,wBAC/ByC,OAAOC,KAAKC,SAASpD,cAAcI,QAAQC,oBAAoBgD,MAAQrD,cAAcsD,aAAaE,sBAClGN,OAAOC,KAAKC,SAASpD,cAAcI,QAAQE,oBAAoB+C,MAAQrD,cAAcsD,aAAaE,sBAGlGN,OAAOC,KAAKC,SAASpD,cAAcI,QAAQC,oBAAoBoD,YAAa,EAC5EP,OAAOC,KAAKC,SAASpD,cAAcI,QAAQE,oBAAoBmD,YAAa,EAE5EP,OAAOC,KAAKC,SAASpD,cAAcI,QAAQC,oBAAoBqD,UAAW,EAC1ER,OAAOC,KAAKC,SAASpD,cAAcI,QAAQE,oBAAoBoD,UAAW,EAG1ER,OAAOC,KAAKC,SAASpD,cAAcI,QAAQU,wBAAwBoB,QAAS,EAC5EgB,OAAOC,KAAKC,SAASpD,cAAcI,QAAQgB,oBAAoBc,QAAS,EAGxEgB,OAAOS,QAAQhC,QAAQiC,QAAQ3B,OAAShC,mBACxCiD,OAAOS,QAAQhC,QAAQiC,QAAQC,UAAUC,WAAavD,sBAAsBwD,KAAKpD,MACjFuC,OAAOS,QAAQhC,QAAQiC,QAAQI,SAAW,SAAUC,SAAUC,iBACnDD,SAAS9D,aAAe+D,SAAS/D,cAI5C+C,OAAOS,QAAQhC,QAAQC,OAASN,eAEzB4B,QAGJP"}
\ No newline at end of file
/**
* Customized output for the attempt administration chart data.
*
* @module mod_adaptivequiz/attempt_administration_chart_output_htmltable
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("mod_adaptivequiz/attempt_administration_chart_output_htmltable",["jquery","core/chart_output_htmltable","mod_adaptivequiz/attempt_administration_chart_dataset_config"],(function($,OutputTable,DatasetConfig){function AttemptAdministrationChartOutputTable(){OutputTable.apply(this,arguments)}return AttemptAdministrationChartOutputTable.prototype=Object.create(OutputTable.prototype),AttemptAdministrationChartOutputTable.prototype._makeTable=function(){let tbl=OutputTable.prototype._makeTable.apply(this,arguments);const dataIndicesToRemove=[DatasetConfig.indices.STANDARD_ERROR_MAX,DatasetConfig.indices.STANDARD_ERROR_MIN],selectorsToRemove=dataIndicesToRemove.flatMap((dataIndexToRemove=>["th:nth-child(".concat(dataIndexToRemove+2,")"),"td:nth-child(".concat(dataIndexToRemove+2,")")]));return tbl.find(selectorsToRemove.join()).remove(),tbl},AttemptAdministrationChartOutputTable}));
//# sourceMappingURL=attempt_administration_chart_output_htmltable.min.js.map
\ No newline at end of file
{"version":3,"file":"attempt_administration_chart_output_htmltable.min.js","sources":["../src/attempt_administration_chart_output_htmltable.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Customized output for the attempt administration chart data.\n *\n * @module mod_adaptivequiz/attempt_administration_chart_output_htmltable\n * @copyright 2024 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/chart_output_htmltable',\n 'mod_adaptivequiz/attempt_administration_chart_dataset_config'\n], function (\n $,\n OutputTable,\n DatasetConfig\n) {\n\n /**\n * Output for the attempt administration chart data.\n *\n * @class\n * @extends {module:core/chart_output_htmltable}\n */\n function AttemptAdministrationChartOutputTable() {\n OutputTable.apply(this, arguments);\n }\n AttemptAdministrationChartOutputTable.prototype = Object.create(OutputTable.prototype);\n\n /**\n * Overrides building the table.\n *\n * @override\n * @protected\n * @return {Object} Modified table node.\n */\n AttemptAdministrationChartOutputTable.prototype._makeTable = function() {\n let tbl = OutputTable.prototype._makeTable.apply(this, arguments);\n\n // Remove columns with standard error min/max.\n const dataIndicesToRemove = [DatasetConfig.indices.STANDARD_ERROR_MAX, DatasetConfig.indices.STANDARD_ERROR_MIN];\n\n const selectorsToRemove = dataIndicesToRemove.flatMap(\n (dataIndexToRemove) => [`th:nth-child(${dataIndexToRemove + 2})`, `td:nth-child(${dataIndexToRemove + 2})`]\n );\n\n tbl.find(selectorsToRemove.join()).remove();\n\n return tbl;\n };\n\n return AttemptAdministrationChartOutputTable;\n});\n"],"names":["define","$","OutputTable","DatasetConfig","AttemptAdministrationChartOutputTable","apply","this","arguments","prototype","Object","create","_makeTable","tbl","dataIndicesToRemove","indices","STANDARD_ERROR_MAX","STANDARD_ERROR_MIN","selectorsToRemove","flatMap","dataIndexToRemove","find","join","remove"],"mappings":";;;;;;;AAsBAA,wEAAO,CACH,SACA,8BACA,iEACD,SACCC,EACAC,YACAC,wBASSC,wCACLF,YAAYG,MAAMC,KAAMC,kBAE5BH,sCAAsCI,UAAYC,OAAOC,OAAOR,YAAYM,WAS5EJ,sCAAsCI,UAAUG,WAAa,eACrDC,IAAMV,YAAYM,UAAUG,WAAWN,MAAMC,KAAMC,iBAGjDM,oBAAsB,CAACV,cAAcW,QAAQC,mBAAoBZ,cAAcW,QAAQE,oBAEvFC,kBAAoBJ,oBAAoBK,SACzCC,mBAAsB,wBAAiBA,kBAAoB,8BAAsBA,kBAAoB,iBAG1GP,IAAIQ,KAAKH,kBAAkBI,QAAQC,SAE5BV,KAGJR"}
\ No newline at end of file
define("mod_adaptivequiz/attempt_answers_distribution_chart_manager",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Module to manage appearance of the answers distribution chart.
*
* @module mod_adaptivequiz/attempt_answers_distribution_chart_manager
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification);_exports.init=(chartOutput,chartBar,userId,adaptiveQuizId)=>{document.querySelector('[data-action="set-answers-distribution-chart-stacked"]').addEventListener("change",(e=>{const setStacked=e.target.checked;chartBar.setStacked(setStacked),chartOutput.update(),_ajax.default.call([{methodname:"core_user_set_user_preferences",args:{preferences:[{name:"mod_adaptivequiz_answers_distribution_chart_settings_".concat(adaptiveQuizId),value:JSON.stringify({showstacked:setStacked}),userid:userId}]}}])[0].catch(_notification.default.exception)}))}}));
//# sourceMappingURL=attempt_answers_distribution_chart_manager.min.js.map
\ No newline at end of file
{"version":3,"file":"attempt_answers_distribution_chart_manager.min.js","sources":["../src/attempt_answers_distribution_chart_manager.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to manage appearance of the answers distribution chart.\n *\n * @module mod_adaptivequiz/attempt_answers_distribution_chart_manager\n * @copyright 2024 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Entry point of the module.\n *\n * @param {Object} chartOutput An instance of Output.\n * @param {Object} chartBar An instance of Bar.\n * @param {Number} userId Current user to set the preferences for.\n * @param {Number} adaptiveQuizId Adaptive quiz instance to set the preferences for.\n */\nexport const init = (chartOutput, chartBar, userId, adaptiveQuizId) => {\n let stackedFlagControl = document.querySelector('[data-action=\"set-answers-distribution-chart-stacked\"]');\n\n stackedFlagControl.addEventListener('change', (e) => {\n const setStacked = e.target.checked;\n\n chartBar.setStacked(setStacked);\n chartOutput.update();\n\n Ajax.call([{\n methodname: 'core_user_set_user_preferences',\n args: {\n preferences: [{\n name: `mod_adaptivequiz_answers_distribution_chart_settings_${adaptiveQuizId}`,\n value: JSON.stringify({\n showstacked: setStacked,\n }),\n userid: userId,\n }]\n }\n }])[0].catch(Notification.exception);\n });\n};\n"],"names":["chartOutput","chartBar","userId","adaptiveQuizId","document","querySelector","addEventListener","e","setStacked","target","checked","update","call","methodname","args","preferences","name","value","JSON","stringify","showstacked","userid","catch","Notification","exception"],"mappings":";;;;;;;wLAkCoB,CAACA,YAAaC,SAAUC,OAAQC,kBACvBC,SAASC,cAAc,0DAE7BC,iBAAiB,UAAWC,UACrCC,WAAaD,EAAEE,OAAOC,QAE5BT,SAASO,WAAWA,YACpBR,YAAYW,uBAEPC,KAAK,CAAC,CACPC,WAAY,iCACZC,KAAM,CACFC,YAAa,CAAC,CACVC,oEAA8Db,gBAC9Dc,MAAOC,KAAKC,UAAU,CAClBC,YAAaZ,aAEjBa,OAAQnB,aAGhB,GAAGoB,MAAMC,sBAAaC"}
\ No newline at end of file
define("mod_adaptivequiz/item_administration_params",["exports","core_form/modalform","core/str"],(function(_exports,_modalform,_str){var obj;
/**
* Module to edit item administration settings.
*
* @module mod_adaptivequiz/item_administration_settings
* @copyright 2026 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=(obj=_modalform)&&obj.__esModule?obj:{default:obj};const SELECTORS_showEditParamsDialog='[data-action="show-edit-params-dialog"]';_exports.init=()=>{document.querySelector(SELECTORS_showEditParamsDialog).addEventListener("click",(e=>{const idFormArg=e.target.dataset.id,form=new _modalform.default({formClass:"mod_adaptivequiz\\form\\item_administration_params_form",args:{id:idFormArg},modalConfig:{title:(0,_str.getString)("itembankitemadmparamsedit","adaptivequiz")},saveButtonText:(0,_str.getString)("save")});form.addEventListener(form.events.FORM_SUBMITTED,(()=>window.location.reload())),form.show()}))}}));
//# sourceMappingURL=item_administration_params.min.js.map
\ No newline at end of file
{"version":3,"file":"item_administration_params.min.js","sources":["../src/item_administration_params.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to edit item administration settings.\n *\n * @module mod_adaptivequiz/item_administration_settings\n * @copyright 2026 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport {getString} from 'core/str';\n\n/**\n * DOM selectors.\n *\n * @constant\n * @type Object\n */\nconst SELECTORS = {\n showEditParamsDialog: '[data-action=\"show-edit-params-dialog\"]',\n};\n\n/**\n * Entry point of the module.\n */\nexport const init = () => {\n document.querySelector(SELECTORS.showEditParamsDialog).addEventListener('click', (e) => {\n const idFormArg = e.target.dataset.id;\n\n const form = new ModalForm({\n formClass: \"mod_adaptivequiz\\\\form\\\\item_administration_params_form\",\n args: {\n id: idFormArg,\n },\n modalConfig: {\n title: getString('itembankitemadmparamsedit', 'adaptivequiz'),\n },\n saveButtonText: getString('save'),\n });\n\n form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());\n form.show();\n });\n};\n"],"names":["SELECTORS","document","querySelector","addEventListener","e","idFormArg","target","dataset","id","form","ModalForm","formClass","args","modalConfig","title","saveButtonText","events","FORM_SUBMITTED","window","location","reload","show"],"mappings":";;;;;;;sJAgCMA,+BACoB,wDAMN,KAChBC,SAASC,cAAcF,gCAAgCG,iBAAiB,SAAUC,UACxEC,UAAYD,EAAEE,OAAOC,QAAQC,GAE7BC,KAAO,IAAIC,mBAAU,CACvBC,UAAW,0DACXC,KAAM,CACFJ,GAAIH,WAERQ,YAAa,CACTC,OAAO,kBAAU,4BAA6B,iBAElDC,gBAAgB,kBAAU,UAG9BN,KAAKN,iBAAiBM,KAAKO,OAAOC,gBAAgB,IAAMC,OAAOC,SAASC,WACxEX,KAAKY"}
\ No newline at end of file
define("mod_adaptivequiz/item_bank",["exports","core_form/modalform","core/str"],(function(_exports,_modalform,_str){var obj;
/**
* Module to manage item bank.
*
* @module mod_adaptivequiz/item_bank
* @copyright 2026 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=(obj=_modalform)&&obj.__esModule?obj:{default:obj};const SELECTORS_showQuestionBanksDialog='[data-action="show-question-banks-dialog"]';_exports.init=()=>{document.querySelector(SELECTORS_showQuestionBanksDialog).addEventListener("click",(e=>{const idFormArg=e.target.dataset.id,courseIdFormArg=e.target.dataset.courseId,form=new _modalform.default({formClass:"mod_adaptivequiz\\form\\assign_question_bank_form",args:{id:idFormArg,course:courseIdFormArg},modalConfig:{title:(0,_str.getString)("itembankeditqbanks","adaptivequiz")},saveButtonText:(0,_str.getString)("itembankaddqbankbn","adaptivequiz")});form.addEventListener(form.events.FORM_SUBMITTED,(()=>window.location.reload())),form.show()}))}}));
//# sourceMappingURL=item_bank.min.js.map
\ No newline at end of file
{"version":3,"file":"item_bank.min.js","sources":["../src/item_bank.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to manage item bank.\n *\n * @module mod_adaptivequiz/item_bank\n * @copyright 2026 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport {getString} from 'core/str';\n\n/**\n * DOM selectors.\n *\n * @constant\n * @type Object\n */\nconst SELECTORS = {\n showQuestionBanksDialog: '[data-action=\"show-question-banks-dialog\"]',\n};\n\n/**\n * Entry point of the module.\n */\nexport const init = () => {\n document.querySelector(SELECTORS.showQuestionBanksDialog).addEventListener('click', (e) => {\n const idFormArg = e.target.dataset.id;\n const courseIdFormArg = e.target.dataset.courseId;\n\n const form = new ModalForm({\n formClass: \"mod_adaptivequiz\\\\form\\\\assign_question_bank_form\",\n args: {\n id: idFormArg,\n course: courseIdFormArg,\n },\n modalConfig: {\n title: getString('itembankeditqbanks', 'adaptivequiz'),\n },\n saveButtonText: getString('itembankaddqbankbn', 'adaptivequiz'),\n });\n\n form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());\n form.show();\n\n });\n};\n"],"names":["SELECTORS","document","querySelector","addEventListener","e","idFormArg","target","dataset","id","courseIdFormArg","courseId","form","ModalForm","formClass","args","course","modalConfig","title","saveButtonText","events","FORM_SUBMITTED","window","location","reload","show"],"mappings":";;;;;;;sJAgCMA,kCACuB,2DAMT,KAChBC,SAASC,cAAcF,mCAAmCG,iBAAiB,SAAUC,UAC3EC,UAAYD,EAAEE,OAAOC,QAAQC,GAC7BC,gBAAkBL,EAAEE,OAAOC,QAAQG,SAEnCC,KAAO,IAAIC,mBAAU,CACvBC,UAAW,oDACXC,KAAM,CACFN,GAAIH,UACJU,OAAQN,iBAEZO,YAAa,CACTC,OAAO,kBAAU,qBAAsB,iBAE3CC,gBAAgB,kBAAU,qBAAsB,kBAGpDP,KAAKR,iBAAiBQ,KAAKQ,OAAOC,gBAAgB,IAAMC,OAAOC,SAASC,WACxEZ,KAAKa"}
\ No newline at end of file
define("mod_adaptivequiz/question_banks_datasource",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){var obj;
/**
* Autocomplete data source for question bank selectors.
*
* @module mod_adaptivequiz/question_banks_datasource
* @copyright 2026 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var _default={transport:function(selector,query,callback){const element=document.querySelector(selector),contextId=element.dataset.contextid,inCourseId=element.dataset.incourseid,notInCourseId=element.dataset.notincourseid;if(!contextId)throw new Error("The attribute data-contextid is required on "+selector);(0,_ajax.call)([{methodname:"mod_adaptivequiz_search_question_banks",args:{contextid:contextId,incourseid:inCourseId,notincourseid:notInCourseId,search:query}}])[0].then(callback).catch(_notification.default.exception)},processResults:(selector,results)=>results.questionbanks};return _exports.default=_default,_exports.default}));
//# sourceMappingURL=question_banks_datasource.min.js.map
\ No newline at end of file
{"version":3,"file":"question_banks_datasource.min.js","sources":["../src/question_banks_datasource.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Autocomplete data source for question bank selectors.\n *\n * @module mod_adaptivequiz/question_banks_datasource\n * @copyright 2026 Vitaly Potenko <potenkov@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport Notification from 'core/notification';\n\nexport default {\n\n /**\n * Source of data for Ajax element.\n *\n * @param {String} selector The selector of the auto complete element.\n * @param {String} query The query string.\n * @param {Function} callback A callback function receiving an array of results.\n */\n transport: function(selector, query, callback) {\n const element = document.querySelector(selector);\n const contextId = element.dataset.contextid;\n const inCourseId = element.dataset.incourseid;\n const notInCourseId = element.dataset.notincourseid;\n\n if (!contextId) {\n throw new Error('The attribute data-contextid is required on ' + selector);\n }\n\n fetchMany([{\n methodname: 'mod_adaptivequiz_search_question_banks',\n args: {\n contextid: contextId,\n incourseid: inCourseId,\n notincourseid: notInCourseId,\n search: query,\n },\n }])[0]\n .then(callback)\n .catch(Notification.exception);\n },\n\n /**\n * Process the results for auto complete elements.\n *\n * @param {String} selector The selector of the auto complete element.\n * @param {Array} results An array or results.\n * @return {Array} New array of results.\n */\n processResults: (selector, results) => {\n return results.questionbanks;\n },\n};\n"],"names":["transport","selector","query","callback","element","document","querySelector","contextId","dataset","contextid","inCourseId","incourseid","notInCourseId","notincourseid","Error","methodname","args","search","then","catch","Notification","exception","processResults","results","questionbanks"],"mappings":";;;;;;;sKA0Be,CASXA,UAAW,SAASC,SAAUC,MAAOC,gBAC3BC,QAAUC,SAASC,cAAcL,UACjCM,UAAYH,QAAQI,QAAQC,UAC5BC,WAAaN,QAAQI,QAAQG,WAC7BC,cAAgBR,QAAQI,QAAQK,kBAEjCN,gBACK,IAAIO,MAAM,+CAAiDb,yBAG3D,CAAC,CACPc,WAAY,yCACZC,KAAM,CACFP,UAAWF,UACXI,WAAYD,WACZG,cAAeD,cACfK,OAAQf,UAEZ,GACCgB,KAAKf,UACLgB,MAAMC,sBAAaC,YAU5BC,eAAgB,CAACrB,SAAUsB,UAChBA,QAAQC"}
\ No newline at end of file
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines order and indices for datasets.
*
* @module mod_adaptivequiz/attempt_administration_chart_dataset_config
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
export default {
orderWeights: {
ABILITY_MEASURE: 10,
ADMINISTERED_DIFFICULTY: 20,
TARGET_DIFFICULTY: 30,
STANDARD_ERROR_BORDER: 40,
STANDARD_ERROR_PERCENT: 50,
CORRECT_WRONG_FLAG: 60,
},
indices: {
TARGET_DIFFICULTY: 0,
ADMINISTERED_DIFFICULTY: 1,
CORRECT_WRONG_FLAG: 2,
ABILITY_MEASURE: 3,
STANDARD_ERROR_MAX: 4,
STANDARD_ERROR_MIN: 5,
STANDARD_ERROR_PERCENT: 6,
},
};
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Customized output for the attempt administration chart.
*
* The class overrides some definitions from core/chart_output_chartjs for custom output.
*
* @module mod_adaptivequiz/attempt_administration_chart_output
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define([
'core/chart_output_chartjs',
'core/chartjs',
'mod_adaptivequiz/attempt_administration_chart_dataset_config'
], function(
Output,
Chartjs,
DatasetConfig
) {
/**
* Used to set the color as a hex code to avoid inconsistencies from Chartjs when displaying the color with opacity specified.
*/
const STANDARD_ERROR_LABEL_COLOR = '#ffcce0';
/**
* A filter callback for tooltip items.
*
* @param {Object} tooltipItem
* @return {Boolean}
*/
const tooltipItemsFilter = function (tooltipItem) {
return !(tooltipItem.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MAX
|| tooltipItem.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MIN);
};
/**
* A callback to add text after a tooltip item.
*
* @param {Object} tooltipItem
* @return {String}
*/
const afterTooltipItemLabel = function (tooltipItem) {
// Show extra text only after the ability measure and administered difficulty items.
if (!(tooltipItem.datasetIndex === DatasetConfig.indices.ABILITY_MEASURE
|| tooltipItem.datasetIndex === DatasetConfig.indices.ADMINISTERED_DIFFICULTY)) {
return '';
}
// If this is the ability measure item.
if (tooltipItem.datasetIndex === DatasetConfig.indices.ABILITY_MEASURE) {
// Reach out to the standard error data.
const stdErrorSeries = this._chart.getSeries()[DatasetConfig.indices.STANDARD_ERROR_PERCENT];
const stdErrorValue = stdErrorSeries.getValues()[tooltipItem.dataIndex];
return `${stdErrorSeries.getLabel()}: ${stdErrorValue}`;
}
// The rest case - administered difficulty item.
// Reach out to the right/wrong data.
const rightWrongSeries = this._chart.getSeries()[DatasetConfig.indices.CORRECT_WRONG_FLAG];
const rightWrongValue = rightWrongSeries.getValues()[tooltipItem.dataIndex];
return `${rightWrongSeries.getLabel()}: ${rightWrongValue}`;
};
/**
* Returns part of the config to set up the legend.
*
* @return {Object}
*/
const legendConfig = function () {
return {
labels: {
generateLabels(chart) {
let labels = Chartjs.defaults.plugins.legend.labels.generateLabels(chart);
// Store the standard error label for future use.
const stdErrorLabelText = labels.find((label) =>
label.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_PERCENT).text;
// Remove everything hidden and one of the standard error labels.
labels = labels.filter((label) =>
!label.hidden && label.datasetIndex !== DatasetConfig.indices.STANDARD_ERROR_MIN);
// Order by dataset index.
labels.sort((label1, label2) => label1.datasetIndex - label2.datasetIndex);
// Convert one of the standard error labels to a proper one.
const stdErrorMaxIndex = labels.findIndex((label) =>
label.datasetIndex === DatasetConfig.indices.STANDARD_ERROR_MAX);
labels[stdErrorMaxIndex].text = stdErrorLabelText;
labels[stdErrorMaxIndex].strokeStyle = STANDARD_ERROR_LABEL_COLOR;
labels[stdErrorMaxIndex].fillStyle = STANDARD_ERROR_LABEL_COLOR;
return labels;
}
},
onClick: function () {
return false;
}
};
};
/**
* Output for the attempt administration chart.
*
* @class
* @extends {module:core/chart_output_chartjs}
*/
function AttemptAdministrationChartOutput() {
Output.apply(this, arguments);
}
AttemptAdministrationChartOutput.prototype = Object.create(Output.prototype);
/**
* Overrides config definition to add more custom features.
*
* @protected
* @override
* @return {Object}
*/
AttemptAdministrationChartOutput.prototype._makeConfig = function () {
let config = Output.prototype._makeConfig.apply(this, arguments);
// Define draw order.
config.data.datasets[DatasetConfig.indices.ABILITY_MEASURE].order = DatasetConfig.orderWeights.ABILITY_MEASURE;
config.data.datasets[DatasetConfig.indices.TARGET_DIFFICULTY].order = DatasetConfig.orderWeights.TARGET_DIFFICULTY;
config.data.datasets[DatasetConfig.indices.ADMINISTERED_DIFFICULTY].order =
DatasetConfig.orderWeights.ADMINISTERED_DIFFICULTY;
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].order = DatasetConfig.orderWeights.STANDARD_ERROR_BORDER;
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].order = DatasetConfig.orderWeights.STANDARD_ERROR_BORDER;
// Hide lines and points for standard error min/max datasets.
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].pointStyle = false;
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].pointStyle = false;
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MAX].showLine = false;
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_MIN].showLine = false;
// Hide entire datasets with standard error percentages and right/wrong flags.
config.data.datasets[DatasetConfig.indices.STANDARD_ERROR_PERCENT].hidden = true;
config.data.datasets[DatasetConfig.indices.CORRECT_WRONG_FLAG].hidden = true;
// Tooltip.
config.options.plugins.tooltip.filter = tooltipItemsFilter;
config.options.plugins.tooltip.callbacks.afterLabel = afterTooltipItemLabel.bind(this);
config.options.plugins.tooltip.itemSort = function (tooltip1, tooltip2) {
return tooltip1.datasetIndex - tooltip2.datasetIndex;
};
// Legend.
config.options.plugins.legend = legendConfig();
return config;
};
return AttemptAdministrationChartOutput;
});
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Customized output for the attempt administration chart data.
*
* @module mod_adaptivequiz/attempt_administration_chart_output_htmltable
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define([
'jquery',
'core/chart_output_htmltable',
'mod_adaptivequiz/attempt_administration_chart_dataset_config'
], function (
$,
OutputTable,
DatasetConfig
) {
/**
* Output for the attempt administration chart data.
*
* @class
* @extends {module:core/chart_output_htmltable}
*/
function AttemptAdministrationChartOutputTable() {
OutputTable.apply(this, arguments);
}
AttemptAdministrationChartOutputTable.prototype = Object.create(OutputTable.prototype);
/**
* Overrides building the table.
*
* @override
* @protected
* @return {Object} Modified table node.
*/
AttemptAdministrationChartOutputTable.prototype._makeTable = function() {
let tbl = OutputTable.prototype._makeTable.apply(this, arguments);
// Remove columns with standard error min/max.
const dataIndicesToRemove = [DatasetConfig.indices.STANDARD_ERROR_MAX, DatasetConfig.indices.STANDARD_ERROR_MIN];
const selectorsToRemove = dataIndicesToRemove.flatMap(
(dataIndexToRemove) => [`th:nth-child(${dataIndexToRemove + 2})`, `td:nth-child(${dataIndexToRemove + 2})`]
);
tbl.find(selectorsToRemove.join()).remove();
return tbl;
};
return AttemptAdministrationChartOutputTable;
});
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Module to manage appearance of the answers distribution chart.
*
* @module mod_adaptivequiz/attempt_answers_distribution_chart_manager
* @copyright 2024 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import Ajax from 'core/ajax';
import Notification from 'core/notification';
/**
* Entry point of the module.
*
* @param {Object} chartOutput An instance of Output.
* @param {Object} chartBar An instance of Bar.
* @param {Number} userId Current user to set the preferences for.
* @param {Number} adaptiveQuizId Adaptive quiz instance to set the preferences for.
*/
export const init = (chartOutput, chartBar, userId, adaptiveQuizId) => {
let stackedFlagControl = document.querySelector('[data-action="set-answers-distribution-chart-stacked"]');
stackedFlagControl.addEventListener('change', (e) => {
const setStacked = e.target.checked;
chartBar.setStacked(setStacked);
chartOutput.update();
Ajax.call([{
methodname: 'core_user_set_user_preferences',
args: {
preferences: [{
name: `mod_adaptivequiz_answers_distribution_chart_settings_${adaptiveQuizId}`,
value: JSON.stringify({
showstacked: setStacked,
}),
userid: userId,
}]
}
}])[0].catch(Notification.exception);
});
};
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Module to edit item administration settings.
*
* @module mod_adaptivequiz/item_administration_settings
* @copyright 2026 Vitaly Potenko <potenkov@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import ModalForm from 'core_form/modalform';
import {getString} from 'core/str';
/**
* DOM selectors.
*
* @constant
* @type Object
*/
const SELECTORS = {
showEditParamsDialog: '[data-action="show-edit-params-dialog"]',
};
/**
* Entry point of the module.
*/
export const init = () => {
document.querySelector(SELECTORS.showEditParamsDialog).addEventListener('click', (e) => {
const idFormArg = e.target.dataset.id;
const form = new ModalForm({
formClass: "mod_adaptivequiz\\form\\item_administration_params_form",
args: {
id: idFormArg,
},
modalConfig: {
title: getString('itembankitemadmparamsedit', 'adaptivequiz'),
},
saveButtonText: getString('save'),
});
form.addEventListener(form.events.FORM_SUBMITTED, () => window.location.reload());
form.show();
});
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment