1051 Commits

Author SHA1 Message Date
Tim Hunt
b77d6b1450 MDL-74610 quiz: multiple grades - show in quiz reports 2024-04-09 15:11:43 +01:00
Ilya Tregubov
9f10899178 Merge branch 'MDL-80099_main' of https://github.com/marxjohnson/moodle 2024-03-22 11:07:55 +08:00
Paul Holden
011619dbd3
MDL-71734 lang: final removal of deprecated 400 strings. 2024-03-21 09:44:15 +00:00
Mark Johnson
ee952d6556
MDL-80099 quiz: Add attempt_state_changed hook
This creates a new hook which is dispatched when a quiz attempt is set
to a new state, or deleted. This is then used by quiz_statistics to
trigger a recalulation, replacing the old event observer (for
submissions) and class callback (for deletions).
2024-03-20 14:58:17 +00:00
Mark Johnson
9a2f82a709
MDL-80099 quiz: Replace quiz_structure_modified callback with hook
This adds a new structure_modified hook to mod_quiz, deprecating the
quiz_stucture_modified class callback used in
recompute_quiz_sumgrades(). The callback will be removed in Moodle 4.8.

The quiz_statsitics plugin which used this callback now defines a hook
callback instead.
2024-03-20 14:58:16 +00:00
Eloy Lafuente (stronk7)
361dfe8145
MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces:
- https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
- https://www.php.net/manual/en/reflectionproperty.setaccessible.php
- https://www.php.net/manual/en/reflectionmethod.setaccessible.php

As of PHP 8.1.0, calling this method has no effect; all methods are
invokable by default. So, let's remove all uses from core, they are
no-op.
2024-03-10 21:15:00 +01:00
Huong Nguyen
57610d2bd9
MDL-78547 quiz: Remove unnecessary call to clear_regrade_date_cache()
This method is designed to clear the values but these values are never set anywhere
It's safe to remove it out of the test now
2024-03-08 12:38:30 +07:00
Huong Nguyen
7701e6a079 Merge branch 'MDL-78547' of https://github.com/timhunt/moodle 2024-03-08 08:51:57 +07:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Tim Hunt
3020d180d8 MDL-78547 quiz: in a preview, if a question has been edited, update it
As part of implementing this, there is a new more efficient method
get_version_information_for_questions_in_attempt to see if any
questions in a quiz need to be updated. The regrade code was updated
to take advantage of this.

Co-authored-by: Khoa Nguyen Dang <khoanguyend7@nashtechglobal.com>
2024-03-07 16:14:47 +00:00
Tim Hunt
76bcbc5ddb MDL-80900 quiz: refine attempt summary
* Move State to above all the times, rather than in the middle.
* Changed 'Completed on' to 'Completed' and 'Submitted on' to 'Submitted'.
2024-03-06 13:50:43 +08:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Luca Bösch
307aee2c42 MDL-80082 quiz_grading: Output 'Nothing to display' as notification. 2024-02-19 15:10:32 +01:00
Paul Holden
7db305c8f4
MDL-80738 quiz_statistics: ensure tests uses a DB-backed lock class.
Fix the test file/class name too.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
2024-01-30 15:38:35 +00:00
Jun Pataleta
c643ea197d
Merge branch 'MDL-79806_master' of https://github.com/marxjohnson/moodle 2023-12-05 12:48:41 +08:00
dragos5436
78e3edf3ef MDL-60632 mod_quiz: Fix chart rendering fail in quiz report
If a quiz activity has negative grading enabled for incorrect answers,
students can achieve overall negative grades in this quiz. If at least
one student achieves a negative grade, the chart at the bottom of the
quiz 'Results' tab will fail to display. This patch add a search for
negative results, removes them from the band below 0 and adds them to
the 0 band. This will make the chart render correctly again.

Co-authored-by: Susana Leitão <sleitao@uporto.pt>
Co-authored-by: Matthias Opitz <m.opitz@ucl.ac.uk>

Removed whitespace at end of lines
2023-12-01 15:17:42 +00:00
Mark Johnson
d1a4268839 MDL-79806 quiz_statistics: Queue recalculation on attempt_deleted 2023-11-30 08:54:14 +00:00
Andrew Nicols
525212f2d2
MDL-78496 core: Address phpcs issues with upgrade.php files 2023-11-19 21:20:53 +08:00
Andrew Nicols
545b36cd4a
MDL-78496 upgrade: remove all the < 4.1.0 upgrade steps
Also includes an upgrade step to prevent upgrading from any
version < 2021112802 (v4.1.0) as anti-cheating measure.
2023-11-17 23:25:36 +08:00
Luca Bösch
9593d46512 MDL-71941 quiz_grading: use 'gradeverb' core string 2023-11-02 16:02:32 +01:00
Mark Johnson
4552591eaa MDL-79807 quiz_statistics: Clear stats cache when question added/removed 2023-10-26 13:45:14 +01:00
Tim Hunt
ec0c4e18ad MDL-79747 quiz stats: task should run as admin the right way
The correct way to get an ad-hoc task to run as the main admin account
is to leave userid as null.

Setting it causes fatal errors if the main admin account is set to
auth: nologin.
2023-10-17 16:38:44 +01:00
Jun Pataleta
9beff03a96
MDL-79626 upgrade: add the 4.3.0 separation line to all upgrade scripts 2023-10-10 10:44:17 +08:00
Sara Arjona
9877a06246
Merge branch 'MDL-79551-master-rc' of https://github.com/junpataleta/moodle 2023-10-04 12:28:14 +02:00
Jun Pataleta
94bc2cd38b
MDL-79551 versions: bump all versions and requires near release 2023-10-04 13:57:17 +08:00
Paul Holden
aa8ab48521 MDL-78971 quiz_grading: escape user identity fields on display. 2023-10-04 01:24:19 +00:00
Andrew Nicols
213fd0cdb3
MDL-78580 mod_quiz: Do not concatenate lang strings 2023-10-03 12:02:29 +08:00
Andrew Nicols
be8093e2c7
Merge branch 'MDL-78580_master' of https://github.com/marxjohnson/moodle 2023-10-03 11:05:42 +08:00
Mark Johnson
e5a7a18ae2 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:43:15 +01:00
Mark Johnson
a92e5c5770 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:16:52 +01:00
Nathan Nguyen
e3bd166b3d MDL-72321 mod_quiz: Use new datafilters for random questions 2023-08-31 15:00:39 +01:00
Paul Holden
b2dd8a3cbd
MDL-78320 quiz_overview: format group names in overview report. 2023-05-24 16:19:29 +01:00
Andrew Nicols
dc01f7df8d
Merge branch 'MDL-78260' of https://github.com/timhunt/moodle 2023-05-19 11:40:14 +08:00
Tim Hunt
9be598a77f MDL-78260 quiz stats: fix View details for random questions 2023-05-17 09:09:13 +01:00
Tim Hunt
60dbaa0065 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:01:27 +01:00
Tim Hunt
7994f1c985 MDL-75576 quiz statistics: don't time-limit the use of cached values
This should have been done as part of  MDL-74762, but was missed.
2023-05-15 09:59:34 +01:00
Tim Hunt
174e2ae3b5 MDL-75576 quiz statistics: don't compute when a user views the qbank
Previously, when a user 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 09:59:34 +01:00
Jun Pataleta
9095bb0ef9 MDL-78000 upgrade: add the 4.2.0 separation line to all upgrade scripts 2023-04-22 23:17:50 +08:00
Eloy Lafuente (stronk7)
061c9d7ba0 MDL-77940 versions: bump all versions and requires near release
version = 2023042400 release version
requires= 2023041800 current rc1 version
2023-04-18 18:08:09 +02:00
Víctor Déniz
b576b068bd MDL-77878 lang: Use fixed strings in tests 2023-04-17 08:49:59 +01:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Andrew Nicols
198842e4f6 MDL-76866 mod_quiz: Use atto for grading test
This test is using xpaths for Atto specifically and is an Atto-specific
test.

It needs to be rewritten to be editor-agnostic.
2023-03-29 20:33:47 +08:00
Tim Hunt
c051fbd0c2 MDL-35745 quiz: let teachers to re-open a Never submitted attempt
In the quiz reports, for any 'Never submitted' attempt, there is
now a 'Re-open' button next to where it says the attempt state.

If that is clicked, there is an 'Are you sure?' pop-up. If the user
continues, the attempt is reopened. If the student now has time left,
the attempt is put into the In progress state. If there is not time
left the attempt is immediately submitted and graded. The
'Are you sure? pop-up says which of those two things will happen.
2023-03-14 13:09:27 +00:00
Andrew Nicols
565a615308 Merge branch 'MDL-77094' of https://github.com/timhunt/moodle 2023-03-07 12:08:58 +08:00
Jake Dallimore
f7134f1083 Merge branch 'MDL-76897' of https://github.com/timhunt/moodle 2023-03-01 12:43:58 +08:00
Meirza
f228e373cc MDL-77299 mod_quiz: Added missing class properties.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.

Co-authored-by: Tim Hunt <t.j.Hunt@open.ac.uk>
2023-03-01 10:09:19 +07:00
Tim Hunt
728160cfbc MDL-76897 quiz: quiz_save_best_grade -> recompute_final_grade
also, the associated quiz_calculate_best_grade (only used here)
moved to a protected method.
2023-02-27 18:41:58 +00:00
Tim Hunt
c212565151 MDL-76897 quiz: quiz_update_all_final_grades -> grade_calculator 2023-02-27 18:41:56 +00:00
Tim Hunt
4080962125 MDL-76897 quiz: quiz_update_all_attempt_sumgrades -> grade_calculator 2023-02-27 18:41:56 +00:00
Tim Hunt
1ee7f41762 MDL-76897 quiz: streamline initalisation of $quiz, $cm, $course 2023-02-27 18:41:55 +00:00