Commit graph

4770 commits

Author SHA1 Message Date
Huong Nguyen
82968da537 Merge branch 'MDL-77136-402' of https://github.com/lucaboesch/moodle into MOODLE_402_STABLE 2023-12-07 08:36:50 +07:00
Jun Pataleta
a94f1b2db0
Merge branch 'MDL-80127_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-12-06 22:12:05 +08:00
Luca Bösch
14e0e1423e MDL-77136 qtype_randomsamatch: Newest versions for shortanswer questions 2023-12-06 14:13:09 +01:00
Luca Bösch
be87aed144 MDL-77136 core_question: Newest versions get_questions_from_categories 2023-12-06 14:13:09 +01:00
Tim Hunt
de1396fd70 MDL-80127 question engine: prevent fatal errors from old bad data 2023-12-06 11:38:26 +00:00
Tim Hunt
4ab988703f MDL-80127 question engine: don't convert null to '' before storing 2023-12-06 11:38:24 +00:00
Andrew Nicols
79a42253c3
MDL-80079 core: Correct incorrect arg to format_string::$options 2023-11-14 22:28:55 +08:00
Mark Johnson
6a9e714c97 MDL-79639 quiz_statistics: Prevent database deadlocks
This changes the cache purge code to select IDs for deletion
first, rather than using a subquery in a DELETE, since this
risks causing a deadlock in MySQL.
2023-10-19 08:58:07 +01:00
Ilya Tregubov
8d4c5ee417
Merge branch 'MDL-79279_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-10-10 11:24:12 +08:00
Sara Arjona
78c09ca6b4
Merge branch 'MDL-69119-M402_angle_bracket_character_in_answers_not_escaped_in_moodle_xml_export_of_multiple_choice_calculated_questions' of https://github.com/ziegenberg/moodle into MOODLE_402_STABLE 2023-10-04 07:51:36 +02:00
Tim Hunt
eff2ee3103 MDL-79279 qformat_xml: multianswer import should support idnumber
Fix suggested by Georg Maißer.
2023-10-03 20:42:23 +01:00
Daniel Ziegenberg
a8f5d84ea6
MDL-69119 qformat_xml: fix mc calculated export
The Moodle XML export of multiple choice calculated questions was
missing proper escaping of answers. Also the indentation of the
generated xml was off.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2023-10-03 12:21:03 +02:00
Andrew Nicols
f929dcc160
Merge branch 'MDL-78580_402_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_402_STABLE 2023-10-03 11:23:23 +08:00
Jun Pataleta
46dc2acea8
Merge branch 'MDL-79254_402_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_402_STABLE 2023-10-03 09:42:13 +08:00
Mark Johnson
d3987bdea9 MDL-79254 quiz_statistics: Convert recalculate task to ad-hoc
Previously, quiz statistics processing happened on a scheduled task.
This task looked for all quizzes with completed attempts, then
determined if those quizzes had a statistics calculation that's newer
than the most recent attempt, then ran the statistics calculation if
needed. It was hard coded to stop processing after 1 hour.

The queries involved in determining which quizzes needed processing
weren't terribly efficient, and combined with the 1 hour limit this made
the statistics unusable on large sites, where they are the most useful.

This converts the scheduled task to an ad-hoc task, and uses an event
observer for mod_quiz\event\attempt_submitted to queue a task when
it is needed. This removes the need for a query to work out what needs
processing, and allows the task processing to be scaled up as needed.
2023-09-27 15:42:57 +01:00
Huong Nguyen
616872837d
Merge branch 'MDL-79332_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-09-18 18:56:30 +07:00
Mark Johnson
3e73c33f99 MDL-78580 report_statistics: Prevent database deadlocks when viewing
If a quiz had a long job to calculate statstics running, this would
cause pages that may also attempt a recalculation (the statistics report
page or question bank) to load very slowly, and possibly result in a
database deadlock.

This change will firstly prevent the question bank page performing
analysis calculations at all, since these are not required for this
page, which will speed up loading and prevent deadlocks on this page.

Secondly, this adds a lock to the recalcuation process so that it cannot
run twice concurrently. This will present the user with a message to
indicate that it is waiting for a running calculation until it is
complete, and eventually it will timeout with a message and debugging.
2023-09-15 15:15:40 +01:00
Luca Bösch
fedce774b9 MDL-79226 questions: check for UTF-8 encoding of the import file 2023-09-12 20:39:45 +02:00
Tim Hunt
1bc6e270cc MDL-79332 Question stats: make loading robust to bad data
We were experiencing problems caused by old stats analysis in our
database, computed when there was a bug, causing fatal errors
when they were displayed. Therefore, this code needs to be robust to that.
2023-09-12 16:58:46 +01:00
Jun Pataleta
33ccb45fc9
MDL-78549 multianswer: Prevent default when clicking feedback trigger 2023-09-08 22:20:55 +08:00
Huong Nguyen
20051d6a31
Merge branch 'MDL-78549-402' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2023-09-08 22:20:55 +08:00
Jun Pataleta
848883f0f0
Merge branch 'MDL-78874-402' of https://github.com/danghieu1407/moodle into MOODLE_402_STABLE 2023-09-05 12:05:49 +08:00
Jun Pataleta
7ce8053de7
MDL-78549 qtype_multianswer: Configure feedback popover trigger via JS
* For some reason, the `data-trigger="hover focus"` does not work when
rendering the popover via HTML. It just defaults to click, so the
feedback popover for qtype_multianswer questions does not show on hover.
Configuring the feedback popover's trigger via JS seems to work.
2023-09-05 09:35:57 +08:00
Jun Pataleta
a9e5225a76
MDL-79107 qtype_essay: Move non_form_fields.feature under qtype_essay 2023-08-31 21:06:21 +08:00
danghieu1407
4e79fb543e MDL-78874 accessibility: Improve descriptive text for check button 2023-08-24 20:47:00 +07:00
Andrew Nicols
13b8473ee5
MDL-77381 qengine: Correct coverage for new test 2023-08-17 09:24:21 +02:00
Andrew Nicols
1a7d80db11
Merge branch 'MDL-77381-MOODLE_402_STABLE' of https://github.com/ScottVerbeek/moodle into MOODLE_402_STABLE 2023-08-17 09:24:21 +02:00
Ilya Tregubov
dc9c9d16f4
Merge branch 'MDL-78939-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2023-08-10 18:42:58 +07:00
Jun Pataleta
5aac33d755
Merge branch 'MDL-77378_402_v3' of https://github.com/TomoTsuyuki/moodle into MOODLE_402_STABLE 2023-08-10 18:42:57 +07:00
ScottVerbeek
51a07db338 MDL-77381 question engine: don't query empty arrays 2023-08-10 08:08:34 +10:00
Ilya Tregubov
ae4ae605b4
Merge branch 'MOODLE_402_STABLE_MDL-78860' of https://github.com/mattporritt/moodle into MOODLE_402_STABLE 2023-08-09 09:43:08 +08:00
Paul Holden
3e11151348
MDL-78939 qformat_xml: fix reference to calculated question files. 2023-08-08 08:09:38 +01:00
Matt Porritt
6177a2f994 MDL-78860 qtype_calculatedmulti: PHP 8.2 compatibility
PHP 8.2 has deprecated setting properties on objects dynamically.
The qtype_calculatedmulti question type had two properties being
set this way($correctanswerlength and$correctanswerformat).
This patch extends the question_answer class to add the properties
when the object is instantiated.
2023-08-04 15:46:46 +10:00
danghieu1407
d7b79e57a9 MDL-78866 question: question_created trigger pre-saving extra fields 2023-08-01 16:00:49 +07:00
Tomo Tsuyuki
1d1b5908db MDL-77378 qtype_multianswer: Fix division by zero errors 2023-08-01 11:25:42 +10:00
Jun Pataleta
ac846f9fd7
MDL-77328 qformat_xml: Avoid dynamic declaration for question_answer
Declare qformat_xml::answerfiles and qformat_xml::feedbackfiles instead
of dynamically declaring answerfiles and feedbackfiles for the
question_answer instance when exporting questions and answers to XML
format.
2023-07-19 14:33:41 +08:00
Jun Pataleta
fe7295010e
MDL-77328 qtype_caclulatedmulti: Use qtype_calculated_answer
The question answers for question type plugins extending
\qtype_calculated now have the type
\qtype_calculated\qtype_calculated_answer. So the answers for test
helper functions make_calculatedmulti_question_singleresponse() and
make_calculatedmulti_question_multiresponse() should also be changed
accordingly.
2023-07-19 14:33:41 +08:00
Jun Pataleta
5fe5629ef2
MDL-77328 qtype_caclulatedsimple: Use qtype_calculated_answer
The question answers for question type plugins extending
\qtype_calculated now have the type
\qtype_calculated\qtype_calculated_answer. So the answers for
make_calculatedsimple_question_sum() should be changed accordingly.
2023-07-19 14:33:41 +08:00
Jun Pataleta
6ec5cfa4e8
MDL-77328 qtype_calculated: Add upgrade.txt notes
* Question type plugins that extend qtype_calculated should be made
aware of the changes about the new question_answer type
\qtype_calculated\qtype_calculated_answer.
2023-07-19 14:33:41 +08:00
Jun Pataleta
91430abc21
Merge branch 'MDL-77328-402' of https://github.com/rezaies/moodle into MOODLE_402_STABLE 2023-07-19 09:54:18 +08:00
Tim Hunt
b69cc0c26d
MDL-76757 delete questions: fix message generation logic
The order was getting scrambled.
2023-07-13 21:43:48 +02:00
Meirza
6e4e0abad7 MDL-77328 qtype_multianswer: Refactor for PHP 8.2 compatibility
This commit addresses compatibility issues in the qtype_multianswer
question type. The following changes were made:

- The usage of the undeclared property $maxmark on subquestions in
  qtype_multianswer was identified as problematic. To resolve this,
  the existing declared property $defaultmark is now being used for
  the same purpose.

By switching to the declared property $defaultmark, compatibility with
PHP 8.2 is ensured and the issue with the undeclared property is
resolved.
2023-07-13 21:04:48 +10:00
Shamim Rezaie
35b64b004a MDL-77328 qtype_calculated: Refactor for PHP 8.2 compatibility
This commit addresses compatibility issues in the qtype_calculated
question type. The following problems were identified and resolved:

- qtype_calculated was reusing the qtype_numerical_answer class and
  setting two additional properties ($correctanswerlength and
  $correctanswerformat) that were not declared. To resolve this, a new
  class, qtype_calculated_answer, was defined and utilised.
- During grading in qtype_numerical, there were references to an
  undeclared property ($unitisright) used to track calculation details.
  This issue was fixed using a 'replace temp with query' refactoring.

These changes ensure the qtype_calculated question type is compatible
with PHP 8.2 and addresses the identified issues.
2023-07-13 21:04:48 +10:00
Meirza
b8949b4c90 MDL-77328 qtype_truefalse: Refactor for PHP 8.2 compatibility
This commit addresses the following issues and improvements in the
qtype_truefalse class:

- Added missing class properties:
 - public $truefeedbackformat
 - public $falsefeedbackformat
 - public $showstandardinstruction
- Updated qtype_truefalse_question to include type hinting for better
  IDE support.
2023-07-13 21:04:48 +10:00
Huong Nguyen
68d5bfe6e3
Merge branch 'MDL-76757-402' of https://github.com/danghieu1407/moodle into MOODLE_402_STABLE 2023-07-13 09:46:44 +07:00
Jake Dallimore
73ec043d4b
Merge branch 'MDL-77912_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-07-13 10:09:26 +08:00
Tim Hunt
22c57001d1 MDL-76996 question bank: fix errors when qbank_statistics is disabled 2023-07-12 11:47:17 +01:00
Tim Hunt
0fc9bfa71a MDL-77912 questions: make multi-choice stats calc robust to bad data 2023-07-11 16:57:58 +01:00
danghieu1407
bb7d15c7e0 MDL-76757 Question bank: Can not delete the question completely 2023-07-10 14:32:35 +07:00
Jun Pataleta
3e592b11fe
Merge branch 'MDL-78488_402' of https://github.com/t-schroeder/moodle into MOODLE_402_STABLE 2023-07-06 11:17:19 +08:00