Moodle
  1. Moodle
  2. MDL-20956

Student can't start new attempt if a quiz has timle limit between attempts and time limit for a quiz, and he doesn't submit previous attempt closing browser window instead

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.6
    • Fix Version/s: 1.9.10
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Student can't start new attempt if a quiz has timle limit between attempts and time limit for a quiz, and he doesn't submit previous attempt closing browser window instead.

      After chat with Tim proposed solution is to add a check
      && $timenow - $quiz->delay1 - $quiz->timelimit < $lastattempt_obj->timestart
      to the $timenow - $quiz->delay1 < $lastattempt when displaying error trying to start attempt.

      We may need to additionaly check of $quiz->timelimit>0 to retain current behavour for not timed-out quizzes. There should be patch for both attempt start and displaying a button to do this.

      Patch for 1.9 will be submitted for people who want to use it, for 2.0 it meant to go to the core.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Oleg Sychev added a comment -

            Just noting conditions that should be changed in 1.9:
            mod/quiz/attempt.php - lines 163, 167
            mod/quiz/view.php - lines 371, 374

            Show
            Oleg Sychev added a comment - Just noting conditions that should be changed in 1.9: mod/quiz/attempt.php - lines 163, 167 mod/quiz/view.php - lines 371, 374
            Hide
            Oleg Sychev added a comment -

            Idea how to settle this for 2.0 (and 1.9 too?): we could change behavour of quiz time delay so it will use
            $timenow - $quiz->delay1 < min($lastattempt_obj->timestart +$quiz->timelimit, $lastattempt)
            for timed quizzes and
            $timenow - $quiz->delay1 < $lastattempt
            for not timed ones.

            I guess no one would object (posted in the forum to actually see).

            Show
            Oleg Sychev added a comment - Idea how to settle this for 2.0 (and 1.9 too?): we could change behavour of quiz time delay so it will use $timenow - $quiz->delay1 < min($lastattempt_obj->timestart +$quiz->timelimit, $lastattempt) for timed quizzes and $timenow - $quiz->delay1 < $lastattempt for not timed ones. I guess no one would object (posted in the forum to actually see).
            Hide
            Oleg Sychev added a comment -

            A patch for 1.9., I hope you could review it. The code issue is absurdly easy and affects only a rather weird behavour, so IMHO fix could be done in stable version without much trouble. (The help files modification could probably use a correction from someone with native English).

            A patch for 2.0 will be available later. It's testing hovewer would be actually easier if MDL-20860 would be fixed and I really could make an attempt.

            P.S. One weird thing I noticed is timestart, timefinish and timedelay stored as seconds with time limit stored as minutes. But that inconsistence could wait, of course.

            Show
            Oleg Sychev added a comment - A patch for 1.9., I hope you could review it. The code issue is absurdly easy and affects only a rather weird behavour, so IMHO fix could be done in stable version without much trouble. (The help files modification could probably use a correction from someone with native English). A patch for 2.0 will be available later. It's testing hovewer would be actually easier if MDL-20860 would be fixed and I really could make an attempt. P.S. One weird thing I noticed is timestart, timefinish and timedelay stored as seconds with time limit stored as minutes. But that inconsistence could wait, of course.
            Hide
            Oleg Sychev added a comment -

            Patch for 2.0. Tested.

            Show
            Oleg Sychev added a comment - Patch for 2.0. Tested.
            Hide
            Tim Hunt added a comment -

            Issues with the patch (that I have fixed):

            1. Your changes broke the existing unit tests, and did not add tests for the new functionality.

            2. You did not change the inter_attempt_delay_access_rule::is_finished method. (Actually, I refactored to eliminate the duplicate code.)

            I decided not to add any more information to the help files. I thought it was more likely to confuse people than help them.

            The inconsistency with timelimit being stored as minutes has already been fixed in Moodle 2.0.

            Show
            Tim Hunt added a comment - Issues with the patch (that I have fixed): 1. Your changes broke the existing unit tests, and did not add tests for the new functionality. 2. You did not change the inter_attempt_delay_access_rule::is_finished method. (Actually, I refactored to eliminate the duplicate code.) I decided not to add any more information to the help files. I thought it was more likely to confuse people than help them. The inconsistency with timelimit being stored as minutes has already been fixed in Moodle 2.0.
            Hide
            Oleg Sychev added a comment -

            Thanks, Tim.

            This will save a lot of emotions this September

            Show
            Oleg Sychev added a comment - Thanks, Tim. This will save a lot of emotions this September

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: