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

Log changes to the version of questions used in quiz

XMLWordPrintable

    • MOODLE_404_STABLE
    • MOODLE_405_STABLE
    • MDL-82587-main
    • Hide
      1. Create a course with a quiz
      2. Add a question to the quiz (any question, doesn't matter)
      3. Navigate to the quiz "Questions" page and edit the question, changing the title (or anything else) so we now have two versions of the question
      4. Navigate to the quiz "Questions" page and use the dropdown next to the question created in step 2 to switch the question version to "v1"
      5. Browse to "Site administration" > "Reports" > "Logs"
      6. Press the "Get these logs" button
      7. Verify you see the "Slot version updated" event and it says something like:

        The user with id '2' updated the slot with id '2' belonging to the quiz with course module id '6'. Its question version was changed from 'Always latest' to '1'.

      8. Play around with changing the question version and check that the corresponding event that gets created always shows the correct information
      9. Navigate to the quiz "Questions" page and use the dropdown next to the question created in step 2 to switch the question version to "Always latest"
      10. Browse to "Site administration" > "Reports" > "Logs"
      11. Press the "Get these logs" button
      12. Verify you see the "Slot version updated" event and it says something like:

        The user with id '2' updated the slot with id '2' belonging to the quiz with course module id '6'. Its question version was changed from '1' to 'Always latest'.

      Show
      Create a course with a quiz Add a question to the quiz (any question, doesn't matter) Navigate to the quiz "Questions" page and edit the question, changing the title (or anything else) so we now have two versions of the question Navigate to the quiz "Questions" page and use the dropdown next to the question created in step 2 to switch the question version to "v1" Browse to "Site administration" > "Reports" > "Logs" Press the "Get these logs" button Verify you see the "Slot version updated" event and it says something like: The user with id '2' updated the slot with id '2' belonging to the quiz with course module id '6'. Its question version was changed from 'Always latest' to '1'. Play around with changing the question version and check that the corresponding event that gets created always shows the correct information Navigate to the quiz "Questions" page and use the dropdown next to the question created in step 2 to switch the question version to "Always latest" Browse to "Site administration" > "Reports" > "Logs" Press the "Get these logs" button Verify you see the "Slot version updated" event and it says something like: The user with id '2' updated the slot with id '2' belonging to the quiz with course module id '6'. Its question version was changed from '1' to 'Always latest'.

      When changing question versions via mod/quiz/edit.php no event is fired when the version is changed. Quiz has many events/hooks for when things change (including when the mark is changed on the same edit page), so it's odd one is missing for this.

      Our specific need for it arose while working on a feature that uses a cache which needs to be purged when something about a specific question type changes - which also needs to be purged when the question version changes.

      The way changing versions is implemented is a bit weird too, it appears to be just done by directly updating the DB in a webservice rather than calling an API (contrast this with how the slot mark is updated via the quiz structure API.

      It seems sensible to move the code for updating the version in to the structure class and create an associated event to fire when the version is updated.

            cameron1729 cameron1729
            cameron1729 cameron1729
            Trisha Milan Trisha Milan
            Tim Hunt Tim Hunt
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m

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