Commit graph

4736 commits

Author SHA1 Message Date
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
Ilya Tregubov
57d3069711
Merge branch 'MDL-78608_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-07-06 09:57:00 +08:00
Tim Schroeder
5014d7bbb4
MDL-78488 question bank: don't load statistics when they are disabled 2023-06-30 11:47:50 +02:00
Tim Hunt
3c311cc9af MDL-78608 question stats: avoid loading data for missing contexts
It turns out that there are plugins which don't (currently)
clean up their question attempts when a context is deleted.
Therefore, we need to make Moodle core robust to that.
2023-06-29 16:26:13 +01:00
mkassaei
2345dcbdfa MDL-77679 Drag and drop question type weird behavior 2023-06-26 17:04:41 +01:00
Andrew Nicols
087043b0fe Merge branch 'MDL-78477_402' of https://github.com/AnupamaSarjoshi/moodle into MOODLE_402_STABLE 2023-06-22 14:34:40 +02:00
Andrew Nicols
8ddac57a20 Merge branch 'MDL-77865_MOODLE_402_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_402_STABLE 2023-06-22 14:34:40 +02:00
Anupama Sarjoshi
cc2638d1b2 MDL-78477 qbank_history: Fix and improve UI for edit menu delete option
Changes done to fix the warnings thrown in the history view when the
last version of a question is deleted and improved UI to display the
message and a Continue button, to navigate back to the Question bank.
2023-06-21 10:46:51 +01:00
Jun Pataleta
24496360d2 Merge branch 'MDL-78369_402' of https://github.com/AnupamaSarjoshi/moodle into MOODLE_402_STABLE 2023-06-19 23:16:55 +08:00
Nathan Nguyen
5b8f9536e0 MDL-77865 qtype_ddwtos: fix incorrect inplace class 2023-06-15 15:02:14 +10:00
Andrew Nicols
42c06e002a
Merge branch 'MDL-69231-402' of https://github.com/lameze/moodle into MOODLE_402_STABLE 2023-06-15 10:59:34 +08:00
Anupama Sarjoshi
cc2512d450 MDL-78369 Multiple choice: Increase Choice and feedback boxes size 2023-06-12 12:07:47 +01:00
Andrew Nicols
abff2a6570
Merge branch 'MDL-78008_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-06-08 12:10:28 +08:00
Simey Lameze
719b351f86 MDL-69231 behat: remaining work for role capability generator
This commit does few things:
* Unify data generators usage to role short name.
* Replace remaining manual steps to use the new data generator.
* Also replaced other manual steps to set config to use data generators.
* Tidy up of some tests, aligning pipes and splitting one line steps into multiple lines.
* Fixes tests to have one Given/When/Then per scenario.
2023-06-02 12:45:36 +08:00
Andrew Nicols
5d89ce0058
Merge branch 'MDL-78327_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-06-01 10:52:31 +08:00
Simey Lameze
2f10bf1a1f MDL-77547 behat: run recalculate task before checking values 2023-05-31 15:04:54 +02:00
Tim Hunt
0384f8dfa0 MDL-78327 question stats: store same timestamp for all question stats 2023-05-31 12:02:23 +01:00
Sara Arjona
e05576d74c Merge branch 'MDL-77547-402' of https://github.com/andelacruz/moodle into MOODLE_402_STABLE 2023-05-31 12:51:25 +02:00
Angelia Dela Cruz
7a5806d3cb MDL-77547 Behat: Coverage to check for bad multichoice questions 2023-05-23 15:16:04 +08:00
Tim Hunt
5630f86d81 MDL-78008 qtype_multianswer: random guess score with missing subqs
Sometimes, due to other bugs, subquestions can get lost, so the code
needs to be robust to this.
2023-05-22 17:01:59 +01:00
Anupama Sarjoshi
c2fbb10a52 MDL-78176 Question: Fix D&D onto image and D&D markers theme issue 2023-05-19 16:31:44 +01:00
Jun Pataleta
1d2b0ade40 Merge branch 'MDL-75576_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-05-16 09:59:11 +08:00
Tim Hunt
4d263b0505 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:03:27 +01:00
Tim Hunt
b112cee58c 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:03:26 +01:00
Tim Hunt
bc7dacecb6 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:03:26 +01:00
Tim Hunt
d1fcfd1de2 MDL-75576 qbank_statistics: remove copy-pasted PHPdoc comments
These methods are already correctly documented on the base class.
2023-05-15 10:03:25 +01:00
Jun Pataleta
c6cc0449ed 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:18 +08:00
Jun Pataleta
bd85500e2a Merge branch 'MDL-78011-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE 2023-05-03 09:58:10 +08:00
Ilya Tregubov
7af8bddad7 Merge branch 'MDL-78025_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-05-02 11:43:12 +08:00
Jun Pataleta
20e1d18c29 Merge branch 'MDL-77997_402' of https://github.com/timhunt/moodle into MOODLE_402_STABLE 2023-04-27 10:40:49 +08:00
Tim Hunt
85662b721b 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:36:56 +01:00
Tim Hunt
eb6c618fd4 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:36:56 +01:00
Tim Hunt
8e1583455e 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:30:58 +01:00
Paul Holden
0c74bbfa06
Merge branch 'MDL-77766-402-2' of https://github.com/junpataleta/moodle into MOODLE_402_STABLE 2023-04-25 09:38:36 +01:00
Paul Holden
b82cc59782
MDL-78011 qbank_managecategories: require library for pagesize const. 2023-04-24 15:35:47 +01:00