Moodle
  1. Moodle
  2. MDL-33471

Cron induced switching of incomplete quiz attempts from in progress to never submitted doesnt seem to be occurring

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Quiz
    • Labels:
    • Rank:
      41370

      Description

      See MDLQA-2078 for replication steps.

      As noted at https://tracker.moodle.org/browse/MDL-3030?focusedCommentId=155559&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-155559 its important to wait for over an hour before running cron.

      For some reason my test quiz attempt still says that it is in progress. Im attaching screenshots. Quiz set to close at 8:15. Student logged in at 8:14, answered one question and logged out. Its 9:45 now. Running cron repeatedly has had no effect.

      1. Screenshot.png
        140 kB
      2. Screenshot-1.png
        142 kB

        Issue Links

          Activity

          Hide
          Frédéric Massart added a comment -

          I guess we could enlarge the scope of this issues I experienced other quiz cron bugs. Do you mind Andrew? Or would you think that it's better to open an issue per failed QA?

          Show
          Frédéric Massart added a comment - I guess we could enlarge the scope of this issues I experienced other quiz cron bugs. Do you mind Andrew? Or would you think that it's better to open an issue per failed QA?
          Hide
          Andrew Davis added a comment -

          As long as the issues are closely related they can all be fixed under the one MDL. Looking at the 3 issues currently listed as being blocked by this MDL they all seem fairly closely related (although I dont know the quiz well enough to be certain).

          Show
          Andrew Davis added a comment - As long as the issues are closely related they can all be fixed under the one MDL. Looking at the 3 issues currently listed as being blocked by this MDL they all seem fairly closely related (although I dont know the quiz well enough to be certain).
          Hide
          Tim Hunt added a comment -

          I think one issue makes sense. I am hoping to fix this today.

          Show
          Tim Hunt added a comment - I think one issue makes sense. I am hoping to fix this today.
          Hide
          Tim Hunt added a comment -

          I am puzzled by this, because I thought we had tested this, so I have two theories:

          1. It works on Postgres, but not MySQL

          2. We only really tested the 'graceperiod' option, so perhaps the bug is in other code paths.

          Show
          Tim Hunt added a comment - I am puzzled by this, because I thought we had tested this, so I have two theories: 1. It works on Postgres, but not MySQL 2. We only really tested the 'graceperiod' option, so perhaps the bug is in other code paths.
          Hide
          Tim Hunt added a comment -

          I have been testing, and it works for me. (Postgres)

          1. I created three quizzes, one for each overduehandling option. I gave them a 30 second time-limit (and a 2-day grace period in that case).
          2. As a student, I started an attempt at each quiz, then closed that browser tab.
          3. As teacher, I went to the quiz reports for each quiz, and made sure I could see the in-progress attempts.
          4. Then I waited an hour, and ran cron.
          5. Then I reloaded the quiz reports for each quiz and made sure that the In-progress attempts had moved to the correct new state. In each case, they had.

          Note that getting the right bit of cron to run is tricky. Here is the logic.

          1. To start with, the quiz cron is set to only run once every 60 seconds.

          2. Then, the bit that handles overdue attempts only runs once per hour. There is code like

          $quizconfig = get_config('quiz');
          if ($timenow > $quizconfig->overduelastrun + 3600) {
          

          3. Then the cron processing only considers attempts where the timemodified date is in a certain range. $processto = $timenow - $quizconfig->graceperiodmin; $processfrom is the values of $processto the last time we called the function.

          So, what I conclude from this is that we really need some mtrace output, so people can see if cron has processed the quiz attempts yet. I will add that.

          Note that, if you don't want to wait an hour, you can fake things by deleting the quiz/overduelastrun row from config_plugins.

          Show
          Tim Hunt added a comment - I have been testing, and it works for me. (Postgres) I created three quizzes, one for each overduehandling option. I gave them a 30 second time-limit (and a 2-day grace period in that case). As a student, I started an attempt at each quiz, then closed that browser tab. As teacher, I went to the quiz reports for each quiz, and made sure I could see the in-progress attempts. Then I waited an hour, and ran cron. Then I reloaded the quiz reports for each quiz and made sure that the In-progress attempts had moved to the correct new state. In each case, they had. Note that getting the right bit of cron to run is tricky. Here is the logic. 1. To start with, the quiz cron is set to only run once every 60 seconds. 2. Then, the bit that handles overdue attempts only runs once per hour. There is code like $quizconfig = get_config('quiz'); if ($timenow > $quizconfig->overduelastrun + 3600) { 3. Then the cron processing only considers attempts where the timemodified date is in a certain range. $processto = $timenow - $quizconfig->graceperiodmin; $processfrom is the values of $processto the last time we called the function. So, what I conclude from this is that we really need some mtrace output, so people can see if cron has processed the quiz attempts yet. I will add that. Note that, if you don't want to wait an hour, you can fake things by deleting the quiz/overduelastrun row from config_plugins.
          Hide
          Tim Hunt added a comment -

          So, basically I think this is not-a-bug, but I am using it to submit a commit that improves the mtrace output.

          I will now spend some time testing myself on MySQL.

          Show
          Tim Hunt added a comment - So, basically I think this is not-a-bug, but I am using it to submit a commit that improves the mtrace output. I will now spend some time testing myself on MySQL.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Testing delegated to MDLQA-2078, MDLQA-2074, MDLQA-2072 (being reset now), so passing here.

          Show
          Eloy Lafuente (stronk7) added a comment - Testing delegated to MDLQA-2078 , MDLQA-2074 , MDLQA-2072 (being reset now), so passing here.
          Hide
          Tim Hunt added a comment -

          I just tested the original issue using MySQL too, and it worked for me.

          Show
          Tim Hunt added a comment - I just tested the original issue using MySQL too, and it worked for me.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          We could celebrate it today... but better if we perform a bigger party after releasing Moodle 2.3.

          Print this message and come to Perth that day, it's valid for one beer, wine, coke or... water, as you wish.

          Many thanks for your collaboration!

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - We could celebrate it today... but better if we perform a bigger party after releasing Moodle 2.3. Print this message and come to Perth that day, it's valid for one beer, wine, coke or... water, as you wish. Many thanks for your collaboration! Ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: