4663 Commits

Author SHA1 Message Date
Jun Pataleta
4818dae2fc Merge branch 'MDL-75576_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2023-05-16 09:59:01 +08:00
Tim Hunt
efe895f1bb MDL-75576 quiz/question statistics: don't expire by time
Previously, a set of calculated quiz statistics would only 'last' for
15 minutes. Then they would be considered invalid and not used.

Now, computed statistics are kept indefinitely. Instead, when a new
batch of values are computed for a particular set of settings, older numbers
for the same settings are deleted first. Therefore,
question_stats_cleanup_task is no more.
2023-05-15 10:04:34 +01:00
Tim Hunt
86932a330b MDL-75576 quiz statistics: don't compute when a user views the qbank
Previously, when users viewed the question bank, if the quiz statistics
had not already been calculated, we would try to compute them there an then.
This could be very, very slow, leading to session lock problems.

Now, we never try to compute the statistics on the fly. Instead, we rely
on the existing \quiz_statistics\task\recalculate scheduled task to do it.
2023-05-15 10:04:33 +01:00
Tim Hunt
db9a0e296a MDL-75576 question bank: bulk-load statistics for all questions at once
There is a new method on the column class, for the column to declare any
statistics it requires. The question then efficiently loads all those
statistics in one go, and makes them available as the columns are
rendererd, or do any subsequent processing.
2023-05-15 10:04:33 +01:00
Tim Hunt
9ff59e99ff MDL-75576 qbank_statistics: remove copy-pasted PHPdoc comments
These methods are already correctly documented on the base class.
2023-05-15 10:04:32 +01:00
Jun Pataleta
e9f6b9c2d6 MDL-78125 qtype_multianswer: Convert popover trigger to link
According to Boostrap Popovers documentation for popovers triggered
on focus:
"For proper cross-browser and cross-platform behavior, you must use the
<a> tag, not the <button> tag, and you also must include a tabindex
attribute."
2023-05-12 22:47:11 +08:00
Jun Pataleta
64c625e590 Merge branch 'MDL-78011-401' of https://github.com/paulholden/moodle into MOODLE_401_STABLE 2023-05-03 09:57:56 +08:00
Ilya Tregubov
d28386a29d Merge branch 'MDL-78025_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2023-05-02 11:43:30 +08:00
Jun Pataleta
6c890a6330 Merge branch 'MDL-77997_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2023-04-27 10:40:43 +08:00
Tim Hunt
4a9c0b1410 MDL-78025 questions: questions_in_use should check question_references
This avoids the needs for plugins to do separate queries, which is
easier for them, and better performing.
2023-04-26 15:40:41 +01:00
Tim Hunt
d2d9d762ad MDL-78025 question generator: make the behaviour less surprising
* The object returned by update_question is alwasy a new clone
  and the $question passed in will not be modified.

* The returned object has the fields like questionbankentryid and
  the ones related to versionning, so it is more like the data
  returned by question_bank::load_question_data.
2023-04-26 15:40:36 +01:00
Tim Hunt
a9fa52295a MDL-78025 question: move hiding logic into question_delete_question
This logic belongs in the API, so it is applied consistently.

Also this avoids calling the expensive function questions_in_use
twice per question.
2023-04-26 15:38:57 +01:00
Paul Holden
b867e4db40
MDL-78011 qbank_managecategories: require library for pagesize const. 2023-04-24 15:35:54 +01:00
Jun Pataleta
952c8770b6 MDL-77766 qtype_truefalse: Respect showstandardinstruction
* When showstandardinstruction is set to no, replace the standard
instruction with the generic "Answer" text for the answer options
fieldset's legend.
2023-04-24 20:11:20 +08:00
Jun Pataleta
132ac7486d MDL-77766 qtype_multichoice: Respect showstandardinstruction
* When showstandardinstruction is set to no, replace the standard
instruction with the generic "Answer" text for the answer options
fieldset's legend.
2023-04-24 20:11:20 +08:00
Tim Hunt
a9f629fbf9 MDL-77997 questions: add back Export as XML to the preview screen
The used the exist in Moodle up to 3.11, but then was removed with
insufficient thought in 4.0 (because we had grander long-term plans
which still have not happened). Until those plans happen, this
commit adds the simple link back on the preview screen.
2023-04-24 11:23:47 +01:00
Paul Holden
242ecbf7f3
Merge branch 'MDL-77878-401-enfix' of https://github.com/vmdef/moodle into MOODLE_401_STABLE 2023-04-17 19:12:36 +01:00
Víctor Déniz
1265b0ad84 MDL-77878 lang: Use fixed strings in tests 2023-04-17 09:26:52 +01:00
Helen Foster
2db1ddd290 MDL-77878 lang: Import fixed English strings (en_fix) 2023-04-16 20:54:48 +01:00
Sara Arjona
96f0478ec1 Merge branch 'MDL-77913-401' of https://github.com/paulholden/moodle into MOODLE_401_STABLE 2023-04-14 14:02:18 +02:00
Paul Holden
39cf556111
MDL-77913 qbank_previewquestion: deterministic ordering of versions.
Ensure the ordering of loaded question versions is consistent, avoids
random Oracle failures.
2023-04-13 21:45:28 +01:00
Sara Arjona
69749509ab Merge branch 'MDL-77856-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2023-04-13 09:43:05 +02:00
Anupama Sarjoshi
8b31922739 MDL-77148 core: Fix to export params for templates in correct format
When questions are filtered by tags in the question bank, the qtagids
params are passed in the array format. Though moodle_url handles this,
single_button::export_for_template cannot. Hence changes done in
weblib.php to provide params for export_for_template in the
suitable format.
Thanks Huong. I have added the Behat test you provided in the patch.
2023-04-06 14:38:29 +01:00
Jun Pataleta
85a7c17414 MDL-77856 qtype_multianswer: Use Bootstrap Popover for subq feedback
The YUI Overlay widget encloses the subquestion feedback in a div
which causes a div element to be enclosed in the subquestion span. This
leads to an accessibility issue in terms of HTML parsing as inline
elements (span) should not contain block elements (div)
The YUI Overlay widget is also not accessible as it does not really hide
the overlay contents via aria-hidden when the overlay is not being
shown. It's better if we stop using this and use Bootstrap's
popover component which is more accessible by default.

This patch also removes module.js for the qtype_multianswer plugin as
it only contains codes related to rendering the feedback contents in the
YUI overlay widget which is no longer necessary.
2023-04-06 05:35:11 +08:00
Mark Johnson
6417d795b9 MDL-75301 question: Add "always latest" option to previews 2023-04-05 12:49:58 +02:00
Mark Johnson
c55473ad2e MDL-75301 question: Add behat generator for updating questions
This adds "core_question > updated question" as an entity for `the
following "X" exist` and calls the existing update_question() generator
which will create a new question version with the supplied data.
2023-04-05 12:49:51 +02:00
Paul Holden
5d10e53ba1
Merge branch 'MDL-75017_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2023-03-30 08:47:54 +01:00
Tim Hunt
c1c1ca6e4d MDL-77729 qformat_missingword: fix form of help link 2023-03-25 15:39:27 +00:00
Tim Hunt
fd9b8bf4d0 MDL-75017 questions: give a clear error if the context type is invalid 2023-03-24 13:00:09 +00:00
Tim Hunt
e405e6fd6a MDL-75017 questions: fix weird setup in qformat_xml_import_export_test 2023-03-24 13:00:07 +00:00
Tim Hunt
4bc3782c4c MDL-77626 quiz statistics: Divide by zero if a random Q has max mark 0 2023-03-14 16:34:30 +00:00
Andrew Nicols
23e2b0358c Merge branch 'MDL-76849-401-5' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2023-03-10 09:29:40 +08:00
Sara Arjona
69a91b30cc Merge branch 'MDL-77323-401' of https://github.com/NashTechOpenUniversity/moodle into MOODLE_401_STABLE 2023-03-09 16:48:39 +01:00
Jun Pataleta
bb61d8392b Merge branch 'MDL-77559-401-2' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE 2023-03-09 15:57:44 +08:00
Jun Pataleta
ed6b43b4f2 Merge branch 'MDL-77225_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2023-03-09 10:43:06 +08:00
Andrew Nicols
cd48ae56c7 MDL-77559 js: Rebuild all JS with Node 16 2023-03-09 09:53:19 +08:00
Jun Pataleta
d5cf25faf5 MDL-76849 qtype_essay: Allow question number inclusion in answer fields
* Have the following classes extend qtype_essay_format_renderer_base
  as they have been meant to:
  - qtype_essay_format_editor_renderer
  - qtype_essay_format_noinline_renderer
  - qtype_essay_format_plain_renderer
* Add a question_display_options instance variable for
qtype_essay_format_renderer_base so its subclasses can use it to
generate the label for their respective answer fields.
2023-03-09 08:57:47 +08:00
Jun Pataleta
787278601c MDL-76849 qtype_shortanswer: Include question number in answer fields 2023-03-09 08:57:47 +08:00
Jun Pataleta
880532c71a MDL-76849 qtype_numerical: Include question number in answer fields
* Also covers its qtype_calculated and qtype_calculatedsimple
which extend its renderer class
2023-03-09 08:57:47 +08:00
Jun Pataleta
03b549f225 MDL-76849 qtype_multianswer: Include question number in answer fields
* Add the question number to the answer fields if it's available.
* Improve multiple choice question accessibility:
  - Label the multiple choice question groups appropriately by
    enclosing them in fieldset tags and applying sr-only legend tags to
    label them.
  - Apply Bootstrap form-check classes to the radio buttons, so they
    are rendered better and become responsive as well. This also helps
    avoid the use of the table element for layout purposes when
    rendering horizontal multiple choice sub-questions.
2023-03-09 08:57:47 +08:00
Jun Pataleta
7b6ff446f4 MDL-76849 qtype_match: Include question number in answer fields 2023-03-09 08:57:47 +08:00
Jun Pataleta
9ddbc2d7f0 MDL-76849 qtype_truefalse: Include question number in answer fields
* Improve accessibility as well by grouping the radio buttons
in a fieldset.
2023-03-09 08:57:47 +08:00
Jun Pataleta
fbffd9b148 MDL-76849 qtype_multichoice: Include question number in answer fields
* Improve accessibility as well by grouping the radio buttons/checkboxes
in a fieldset.
2023-03-09 08:57:47 +08:00
Jun Pataleta
2ad0871a82 MDL-76849 qtype_ddwtos: Include question number in answer fields
* Plus include the item number so users will have an idea which blank
numbers they are currently on.
2023-03-09 08:57:47 +08:00
Jun Pataleta
5847b0026e MDL-76849 qtype_gapselect: Include question number in answer fields 2023-03-09 08:57:47 +08:00
Jun Pataleta
6c3f1d55a8 MDL-76849 qtype: Add a questionidentifier instance variable
* Add an instance variable to question_display_options to store the
identifier associated with the question being rendered.
* This information can be used by question type plugins to improve the
accessibility of the answer fields being rendered by adding the
question identifier to the answer fields' labels.
* Adding the question identifier to the label can be achieved by using
question_display_options::add_question_identifier_to_label().

Co-authored-by: Tim Hunt <t.j.hunt@open.ac.uk>
2023-03-09 08:57:47 +08:00
Tim Hunt
7db1da61ee MDL-77225 questions: fix regrade of descriptions in finished attempts
The added logic is similar to the logic in other behaviours, and the new test fails without it.
2023-03-08 19:00:43 +00:00
Tim Hunt
bdcf29ab29 MDL-77464 questions: regrading was losing question_attempt metadata
This is very similar to MDL-77090, but at the time, I missed that this
also needed to be handled. (Question metadata is, I think, only used
by the quiz 'Try another question like this one' feature.)
2023-03-07 13:45:04 +00:00
Tim Hunt
795e8ac70a MDL-77464 questions: update comments in question_attempt_step
The class comment had some inaccuracies which I fixed.
I also replaced all uses of @link with @see.
2023-03-07 13:44:59 +00:00
Jun Pataleta
a377bf30c4 Merge branch 'MDL-75012-401-5' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE 2023-03-02 12:31:09 +08:00