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

Question bank: usage count not correct for random questions

    XMLWordPrintable

Details

    • MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_403_STABLE
    • MDL-76717_master
    • Hide

      This is also covered by behat tests in question/bank/usage/tests/behat/question_usage_column.feature

      1. Create a course.
      2. Create a question category.
      3. Add a question.
      4. Create a quiz.
      5. Add one random question to the quiz, picking from that category.
      6. Attempt the quiz as a student.
      7. Go back to the question bank, and verify it shows "1" in the question's usage column.
      8. Edit the question. No need to change anything, just save.
      9. The question bank should still show "1" in the question's usage column
      10. Create a second quiz
      11. Add a question to the quiz from the question bank, picking the same question created in step 3
      12. Go back to the question bank. It should show show "2" in the question's usage column. Clicking the "2" usage link should show the usage modal, with the 2 usages in Quiz 1 and Quiz 2 listed.
      13. Close the usage modal.
      14. Select Edit > History in the question's table row.
      15. Both versions of the question should be listed.
      16. Each version should show "1" in the usage column.
      17. Clicking the "1" usage link for each version should show the usage modal, listing the quiz where each is used.
      Show
      This is also covered by behat tests in question/bank/usage/tests/behat/question_usage_column.feature Create a course. Create a question category. Add a question. Create a quiz. Add one random question to the quiz, picking from that category. Attempt the quiz as a student. Go back to the question bank, and verify it shows "1" in the question's usage column. Edit the question. No need to change anything, just save. The question bank should still show "1" in the question's usage column Create a second quiz Add a question to the quiz from the question bank, picking the same question created in step 3 Go back to the question bank. It should show show "2" in the question's usage column. Clicking the "2" usage link should show the usage modal, with the 2 usages in Quiz 1 and Quiz 2 listed. Close the usage modal. Select Edit > History in the question's table row. Both versions of the question should be listed. Each version should show "1" in the usage column. Clicking the "1" usage link for each version should show the usage modal, listing the quiz where each is used.

    Description

      Steps to reproduce:

      1. Create a course.
      2. Create a question category.
      3. Add a question.
      4. Create a quiz.
      5. Add one random question to the quiz, picking from that category.
      6. Attempt the quiz as a student.
      7. Go back to the question bank, and verify it shows that the question is used in one quiz.
      8. Edit the question. No need to change anything, just save.

      Actual result: The question bank now shows that this qustion (bank entry) is not used.

      Expected result: It is still used!

      The problematic code is in question/bank/usage/classes/helper.php (and quite a lot about the code there is quite problematic .)

      Attachments

        1. behavior.png
          143 kB
          Ron Carl Alfon Yu
        2. MDL-76717.png
          1.03 MB
          Ron Carl Alfon Yu
        3. step 17.png
          137 kB
          Ron Carl Alfon Yu

        Activity

          People

            marxjohnson Mark Johnson
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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

                Clockify

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