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

Maximum number of attempts setting in Lesson not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.5
    • Fix Version/s: 2.7.4, 2.8.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a new course. You'll also need to enrol a student in this course.
      2. Within the course, create a lesson. In the lesson options, make sure that "Provide option to try a question again" is set to yes and the maximum number of attempts is > 1
      3. Create a question in the lesson. It is easiest just to use a true/false question
      4. Log in as the student that you enrolled in the course. Access the lesson that you created.
      5. Answer the question incorrectly and observe that you are told you have x-y attempt remaining, where x is the maximum amount of attempts and y is the number of guesses you have made on the question.
      6. Repeat this until you run out of guesses. You should be presented with a screen stating "(Maximum number of attempts reached - Moving to next page)"
      7. Add another question to the lesson, this time answer it correctly. Make sure that the flow of the lesson is sane (i.e. it takes you to the next question/end of lesson depending on how many activities are in the lesson).
      Show
      Create a new course. You'll also need to enrol a student in this course. Within the course, create a lesson. In the lesson options, make sure that "Provide option to try a question again" is set to yes and the maximum number of attempts is > 1 Create a question in the lesson. It is easiest just to use a true/false question Log in as the student that you enrolled in the course. Access the lesson that you created. Answer the question incorrectly and observe that you are told you have x-y attempt remaining, where x is the maximum amount of attempts and y is the number of guesses you have made on the question. Repeat this until you run out of guesses. You should be presented with a screen stating "(Maximum number of attempts reached - Moving to next page)" Add another question to the lesson, this time answer it correctly. Make sure that the flow of the lesson is sane (i.e. it takes you to the next question/end of lesson depending on how many activities are in the lesson).
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41155-master
    • Sprint:
      FRONTEND Sprint 15

      Description

      When Provide option to try a question again set to Yes and Max number of attempts is greater than 1, then students can attempt a question many times, even when the max attempt value is reached.

      This issue still exists in v.2.3.x and v2.5. I could reproduce this on the demo.moodle.net site as well.

      There does not seem to be any workaround to this issue.

      Looks like the maxattemptsreached property of the lesson page object isn't checked in all places. The following changes in /mod/lesson/continue.php seems to solve this issue:

      Change:

      if ($result->attemptsremaining != 0 && !$lesson->review && !$reviewmode) {
      

      to:

      if ($result->attemptsremaining != 0 && $lesson->review && !$reviewmode) {
      

      Change:

      if ($result->maxattemptsreached != 0 && !$lesson->review && !$reviewmode) {
      

      to:

      if ($result->maxattemptsreached != 0 && $lesson->review && !$reviewmode) {
      

      Change:

      echo $result->feedback;
      

      to:

      if(!$result->maxattemptsreached && !$reviewmode)
          echo $result->feedback;
      

      Change:

      if (!$result->correctanswer && !$result->noanswer && !$result->isessayquestion && !$reviewmode && $lesson->review) {
      

      to:

      if (!$result->correctanswer && !$result->noanswer && !$result->isessayquestion && !$reviewmode && $lesson->review && !$result->maxattemptsreached) {
      

      Change:

      if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result->isessayquestion) {
      

      to:

      if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result->isessayquestion && !$result->maxattemptsreached) {
      

      The following fields in table mdl_lesson also creates confusion and may have contributed to this bug being introduced:

      • modattempts - this records value for Allow student to review setting
      • review - this records value for Provide option to retry question again

      A similar issue was reported earlier: https://tracker.moodle.org/browse/MDL-23598

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Jan/15