Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-36020 overview/report: fix quiz regrade session lock

  • Loading branch information...
commit 62af3fe42bd256aba01376fdebb3fad290312a8d 1 parent 2d5303c
@troylee troylee authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 mod/quiz/report/overview/report.php
View
13 mod/quiz/report/overview/report.php
@@ -292,6 +292,14 @@ protected function process_actions($quiz, $cm, $currentgroup, $groupstudents, $a
}
/**
+ * Unlock the session and allow the regrading process to run in the background.
+ */
+ protected function unlock_session() {
+ session_get_instance()->write_close();
+ ignore_user_abort(true);
+ }
+
+ /**
* Regrade a particular quiz attempt. Either for real ($dryrun = false), or
* as a pretend regrade to see which fractions would change. The outcome is
* stored in the quiz_overview_regrades table.
@@ -306,7 +314,8 @@ protected function process_actions($quiz, $cm, $currentgroup, $groupstudents, $a
*/
protected function regrade_attempt($attempt, $dryrun = false, $slots = null) {
global $DB;
- set_time_limit(30);
+ // Need more time for a quiz with many questions.
+ set_time_limit(300);
$transaction = $DB->start_delegated_transaction();
@@ -359,6 +368,7 @@ protected function regrade_attempt($attempt, $dryrun = false, $slots = null) {
protected function regrade_attempts($quiz, $dryrun = false,
$groupstudents = array(), $attemptids = array()) {
global $DB;
+ $this->unlock_session();
$where = "quiz = ? AND preview = 0";
$params = array($quiz->id);
@@ -400,6 +410,7 @@ protected function regrade_attempts($quiz, $dryrun = false,
*/
protected function regrade_attempts_needing_it($quiz, $groupstudents) {
global $DB;
+ $this->unlock_session();
$where = "quiza.quiz = ? AND quiza.preview = 0 AND qqr.regraded = 0";
$params = array($quiz->id);
Please sign in to comment.
Something went wrong with that request. Please try again.