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

Quiz with missing question cannot be fixed through the UI

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.2.1, 2.3
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      Becuase of other code changes, the fix would not cherry-pick cleanly 2.1 -> 2.2. Therefore, this needs to be tested in both 2.1 and 2.2.

      1. Create a quiz with a few questions.
      2. Go into the DB, in the mod/quiz table, and add 666, to the start of quiz.questions. Here, 666 is assumed to be any question id that does not exist.
      3. View the quiz edit page, and made sure the missing question is shown in a way that makes sense to you.
      4. Verify that the missing question can be re-ordered and deleted.
      5. Verify that, once the missing question has been deleted, you can then preview the quiz.
      Show
      Becuase of other code changes, the fix would not cherry-pick cleanly 2.1 -> 2.2. Therefore, this needs to be tested in both 2.1 and 2.2. Create a quiz with a few questions. Go into the DB, in the mod/quiz table, and add 666, to the start of quiz.questions. Here, 666 is assumed to be any question id that does not exist. View the quiz edit page, and made sure the missing question is shown in a way that makes sense to you. Verify that the missing question can be re-ordered and deleted. Verify that, once the missing question has been deleted, you can then preview the quiz.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Suppose a quiz gets into a state where $quiz->questions includes a question that no longer exists. It should be impossible for this to happen, but it happened at the OU.

      Then, the missing question does not appear on mod/quiz/edit.php, but when you try to start the quiz, you get a fatal error "Cannot start an attempt at this quiz. The quiz definition includes a question that does not exist."

      What should happen, in this messed up situation, is that the missing question should show up on mod/quiz/edit.php in a suitable way, so you can remove it from the quiz.

      (Would also be good to find the rood cause of how we got into this mess, to prevent it happening again.)

        Gliffy Diagrams

          Activity

          Hide
          timhunt Tim Hunt added a comment -

          Mahmoud, could you take a quick look at these fixes, to make sure that I correctly transferred the chnages we made to standard Moodle.

          Note that this code has changed a bit, so that the fix would not automatically cherry-pick form 2.1 -> 2.2, so I had to do it by hand. Hopefully I have not screwed up.

          Show
          timhunt Tim Hunt added a comment - Mahmoud, could you take a quick look at these fixes, to make sure that I correctly transferred the chnages we made to standard Moodle. Note that this code has changed a bit, so that the fix would not automatically cherry-pick form 2.1 -> 2.2, so I had to do it by hand. Hopefully I have not screwed up.
          Hide
          timhunt Tim Hunt added a comment -

          Note that, as part of this change, some extra class names have been added to the HTML. I thought about it, and I think it is highly unlikely that these extra classes will cause any problems for existing themes.

          On the other hand, the new class names to make it easier for themes to achieve certain desirable effects, as this fix shows.

          Show
          timhunt Tim Hunt added a comment - Note that, as part of this change, some extra class names have been added to the HTML. I thought about it, and I think it is highly unlikely that these extra classes will cause any problems for existing themes. On the other hand, the new class names to make it easier for themes to achieve certain desirable effects, as this fix shows.
          Hide
          mkassaei Mahmoud Kassaei added a comment -

          Following the instructions (steps 1-5). It works for quizzes with no students' attempts.

          If a quiz has been attempted by students it shows the message:

          This question no longer seems to exist
          ? Missing type

          but not the delete icon, which is fine for quizzes which have been attempted.

          The code (php and css changes) looks fine to me.

          Show
          mkassaei Mahmoud Kassaei added a comment - Following the instructions (steps 1-5). It works for quizzes with no students' attempts. If a quiz has been attempted by students it shows the message: This question no longer seems to exist ? Missing type but not the delete icon, which is fine for quizzes which have been attempted. The code (php and css changes) looks fine to me.
          Hide
          timhunt Tim Hunt added a comment -

          Thanks Mahmoud. I'm submitting this for integration now.

          Show
          timhunt Tim Hunt added a comment - Thanks Mahmoud. I'm submitting this for integration now.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks! (21, 22 & master)

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (21, 22 & master)
          Hide
          abgreeve Adrian Greeve added a comment -

          Tested in Master and 2.1. A nice message is displayed informing the user that there is a problem with the question. Then it is possible to remove the question and the page that it was on.

          Show
          abgreeve Adrian Greeve added a comment - Tested in Master and 2.1. A nice message is displayed informing the user that there is a problem with the question. Then it is possible to remove the question and the page that it was on.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          This is now available in the git and cvs repositories.

          Consider the responsibility of your fingerprints engraved there for future generations!

          Thanks for the work, closing, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - This is now available in the git and cvs repositories. Consider the responsibility of your fingerprints engraved there for future generations! Thanks for the work, closing, ciao
          Hide
          kamiobi David Campbell added a comment -

          This has been closed, but I have recently gotten a similar issue I believe. I am using Moodle 2.2.1 (Build: 20120109) and in a quiz that was created in Moodle 1.9.10+ (Build: 20101110) using the MoodleReader ordering quiz type it get this message when trying to preview the quiz "Cannot start an attempt at this quiz. The quiz definition includes a question that does not exist." I am unable to see the question in the question bank to delete it. MoodleReader ordering type has been updated and creating a new question with it works and is viewable.

          Show
          kamiobi David Campbell added a comment - This has been closed, but I have recently gotten a similar issue I believe. I am using Moodle 2.2.1 (Build: 20120109) and in a quiz that was created in Moodle 1.9.10+ (Build: 20101110) using the MoodleReader ordering quiz type it get this message when trying to preview the quiz "Cannot start an attempt at this quiz. The quiz definition includes a question that does not exist." I am unable to see the question in the question bank to delete it. MoodleReader ordering type has been updated and creating a new question with it works and is viewable.
          Hide
          timhunt Tim Hunt added a comment -

          If you look at the bug details, you can see that it says Fix Version/s: 2.2.2. Therefore, your version (2.2.1) still has the bug. You need to upgrade if you want the bug fix.

          Show
          timhunt Tim Hunt added a comment - If you look at the bug details, you can see that it says Fix Version/s: 2.2.2. Therefore, your version (2.2.1) still has the bug. You need to upgrade if you want the bug fix.
          Hide
          kamiobi David Campbell added a comment -

          Thanks, Tim I missed that 2.2.2 part.

          Show
          kamiobi David Campbell added a comment - Thanks, Tim I missed that 2.2.2 part.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Mar/12