Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54907

Automatically submitted quiz attempts: finish time is set to when cron ran, not when the attempt ended

XMLWordPrintable

    • MOODLE_30_STABLE, MOODLE_310_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_36_STABLE, MOODLE_39_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • Hide

      The PHPunit coverage for this is pretty good, but we should have a manual test as well:

      Setup

      1. Log in as Teacher/Admin.
      2. Create a quiz with: Time limit: 1 minute, and other settings default.
      3. Add a question (e.g. true/false is quick to create.

      Normal attempt

      This should not have changed, but we want to verify that there are no regressions.

      1. Log in as Student.
      2. Start an attempt at the quiz, but don't submit.
      3. Just wait until the time reaches 0 and the quiz auto-submits.
      4. Verify that at the top of the review page, verify that the 'Time takes' is about 1 minutes (It is likely to one minute plus a few seconds.)

      Attempt left in the middle and closed by cron

      1. Log in as Student.
      2. Start a second attempt at the quiz, but don't submit.
      3. Instead, just navigate to the course page leaving the attempt open.
      4. Log out and log in again as admin.
      5. Go to Admin -> Server -> Tasks -> Scheduled tasks, and wait until the 'Updating overdue quiz attempts task' has run.
      6. Then, go to the quiz, and go to the quiz reports for the quiz.
      7. Verify that the 'Time taken' for the student's second attempt is exactly 1 minute.
      Show
      The PHPunit coverage for this is pretty good, but we should have a manual test as well: Setup Log in as Teacher/Admin. Create a quiz with: Time limit: 1 minute, and other settings default. Add a question (e.g. true/false is quick to create. Normal attempt This should not have changed, but we want to verify that there are no regressions. Log in as Student. Start an attempt at the quiz, but don't submit. Just wait until the time reaches 0 and the quiz auto-submits. Verify that at the top of the review page, verify that the 'Time takes' is about 1 minutes (It is likely to one minute plus a few seconds.) Attempt left in the middle and closed by cron Log in as Student. Start a second attempt at the quiz, but don't submit. Instead, just navigate to the course page leaving the attempt open. Log out and log in again as admin. Go to Admin -> Server -> Tasks -> Scheduled tasks, and wait until the 'Updating overdue quiz attempts task' has run. Then, go to the quiz, and go to the quiz reports for the quiz. Verify that the 'Time taken' for the student's second attempt is exactly 1 minute.

      When a student starts a quiz attempt, and then goes away before submitting, the quiz attempt will (if the quiz settings say When time expires: in-progress attempts are submitted automatically) get submitted by cron. In this situation, the time recorded is the time that cron ran. This confuses people when an attempt at a quiz with a three-hour time-limit says that it lasted 4.5 hours (if cron is running slow or something.).

      Note that, if the student had tried to log in at 3 hours and a few minutes, the attempt would have been closed there and then.

      Anyway, it would be more accurate to set the time to whichever is greater of: the time when the time-limit expired, or the last-modified time of any question in the attempt, or something.

      Original description follows:

      Problem
      Important information: Quiz duration is set to 5min.
      When a student logs out of Moodle without submitting the open quiz attempt, Moodle keeps counting the time taken for the quiz until the student logs in next time. The quiz remains open and the time completed is left blank. The quiz is only shown as completed, once the student logged in again. The time completed now shows the login time and the time taken shows the time that passed between the start of the quiz and the second login.

      Expected Behaviour
      As soon as quiz duration is over, time completed and time taken are adjusted, independent of the login status of the student.

      How to reproduce

      1. Create a quiz and set the time limit (e.g. to 5min).
      2. Log in as a student and attempt the quiz
      3. Do not submit your attempt and log out
      4. Log in as teacher and have a look at the results:
      5. While the time limit is still open, neither time taken nor time completed are shown. This is correct.
      6. When the time limit is over, time taken and time completed are still not shown but the attempt is still open. This is misleading.
      7. Now log in as student once again and go to the quiz. You will find your attempt closed. This is correct.
      8. Log in again as teacher an have a look at the results. The attempt of the student is now closed. The time taken is the duration between the start time of the quiz and the second login of the student. The time completed is the date and time of the second login of the student. This is incorrect and misleading: It says, that students had more time to take the quiz than they were allowed by the time limit setting. Which is not the case.

      Remark
      I already repoduced the bug on qa.moodle.net. We also encountered this bug on 2.9.3.

            timhunt Tim Hunt
            a.bonaccorso Antonia Bonaccorso
            Mahmoud Kassaei Mahmoud Kassaei
            Jun Pataleta Jun Pataleta
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            13 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 30 minutes
                3h 30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.