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

Replace add_to_log with an event trigger - mod_quiz

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5, 2.6.2
    • Fix Version/s: 2.7
    • Component/s: Events API, Logging, Quiz
    • Labels:
    • Testing Instructions:
      Hide
      Test 1
      1. Run the unit tests in "mod/quiz/tests/events_test.php" and "question/tests/events_test.php" and ensure all passes.
      Test 2
      1. Visit <yoursite>/admin/settings.php?section=managelogging and enable the standard and legacy log.
      2. On one tab open up to <yoursite>/report/log/index.php?id=1 and select the legacy log for now.
      3. Create a quiz instance.
      4. View the quiz and check that there is an 'quiz view' log.
      5. Visit <yoursite>/mod/quiz/index.php?id=<idofthecourse > and check that there is an 'quiz view all' log
      6. Edit the quiz and create a question and check that there is a 'quiz editquestions' log.
      7. Click 'Add a random question' on the edit quiz page and create a category and check that there is a 'quiz addcategory' log.
      8. Click 'Quiz administration' > 'Results' > 'Grades' and check that there is a 'quiz report' log.
      9. Add a question to this quiz, log in as a student, answer the questions and click 'Submit all and finish'. View the log tab and check that there are the following logs in the order - 'quiz attempt' -> 'quiz continue attempt' -> 'quiz view summary' -> 'quiz review'
      10. As an administrator review the attempt and select 'Make comment or override mark'.
      11. Edit the grade, enter a comment, submit and check that there is a 'quiz manualgrade' log.
      12. Under 'Quiz administration' select 'User overrides'.
      13. Click 'Add user override'.
      14. Create a user override and check that there is a 'quiz edit override' log.
      15. Delete this override and check that there is a 'quiz delete override' log.
      16. Delete the user's attempt and check that there is a 'quiz delete attempt log.
      17. On the log tab change to the standard log.
      18. Go through all the above events in the list (note - you do not need to perform the actions again, simply look for them in the log list) and click on the event names and ensure they take you to a valid URL.
      Show
      Test 1 Run the unit tests in "mod/quiz/tests/events_test.php" and "question/tests/events_test.php" and ensure all passes. Test 2 Visit <yoursite>/admin/settings.php?section=managelogging and enable the standard and legacy log. On one tab open up to <yoursite>/report/log/index.php?id=1 and select the legacy log for now. Create a quiz instance. View the quiz and check that there is an 'quiz view' log. Visit <yoursite>/mod/quiz/index.php?id=<idofthecourse > and check that there is an 'quiz view all' log Edit the quiz and create a question and check that there is a 'quiz editquestions' log. Click 'Add a random question' on the edit quiz page and create a category and check that there is a 'quiz addcategory' log. Click 'Quiz administration' > 'Results' > 'Grades' and check that there is a 'quiz report' log. Add a question to this quiz, log in as a student, answer the questions and click 'Submit all and finish'. View the log tab and check that there are the following logs in the order - 'quiz attempt' -> 'quiz continue attempt' -> 'quiz view summary' -> 'quiz review' As an administrator review the attempt and select 'Make comment or override mark'. Edit the grade, enter a comment, submit and check that there is a 'quiz manualgrade' log. Under 'Quiz administration' select 'User overrides'. Click 'Add user override'. Create a user override and check that there is a 'quiz edit override' log. Delete this override and check that there is a 'quiz delete override' log. Delete the user's attempt and check that there is a 'quiz delete attempt log. On the log tab change to the standard log. Go through all the above events in the list (note - you do not need to perform the actions again, simply look for them in the log list) and click on the event names and ensure they take you to a valid URL.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-40063_master
    • Story Points (Obsolete):
      100
    • Sprint:
      BACKEND Sprint 12

      Description

      Replace the add_to_log calls for the following area, with a call to the get_legacy_logdata function in the event class.

      mod/quiz (14 calls)
      /mod/quiz/processattempt.php:164: add_to_log($attemptobj->get_courseid(), 'quiz', 'close attempt',
      /mod/quiz/overridedelete.php:66: add_to_log($cm->course, 'quiz', 'delete override',
      /mod/quiz/attempt.php:98: add_to_log($attemptobj->get_courseid(), 'quiz', 'continue attempt',
      /mod/quiz/report.php:86: add_to_log($course->id, 'quiz', 'report', 'report.php?id=' . $cm->id . '&mode=' . $mode,
      /mod/quiz/index.php:39: add_to_log($course->id, "quiz", "view all", "index.php?id=$course->id", "");
      /mod/quiz/report/attemptsreport.php:321: add_to_log($quiz->course, 'quiz', 'delete attempt', 'report.php?id=' . $cm->id,
      /mod/quiz/edit.php:158: add_to_log($cm->course, 'quiz', 'editquestions',
      /mod/quiz/comment.php:47: add_to_log($attemptobj->get_courseid(), 'quiz', 'manualgrade', 'comment.php?attempt=' .
      /mod/quiz/locallib.php:271: add_to_log($quizobj->get_courseid(), 'quiz', 'preview', 'view.php?id='.$quizobj->get_cmid(),
      /mod/quiz/locallib.php:274: add_to_log($quizobj->get_courseid(), 'quiz', 'attempt', 'review.php?attempt='.$attempt->id,
      /mod/quiz/overrideedit.php:175: add_to_log($cm->course, 'quiz', 'edit override',
      /mod/quiz/addrandom.php:93: add_to_log($quiz->course, 'quiz', 'addcategory',
      /mod/quiz/view.php:73: add_to_log($course->id, 'quiz', 'view', 'view.php?id=' . $cm->id, $quiz->id, $cm->id);
      /mod/quiz/review.php:89: add_to_log($attemptobj->get_courseid(), 'quiz', 'review', 'review.php?attempt=' .
      /mod/quiz/summary.php:81: add_to_log($attemptobj->get_courseid(), 'quiz', 'view summary',

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/May/14