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

Replace add_to_log with an event trigger - mod_choice

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: Events API, Logging
    • Labels:
    • Testing Instructions:
      Hide

      Unit tests

      • Run the following unit tests:
        • events_test.php
        • generator_test.php

      Manual tests

      answers_created

      1. Create a choice activity.
      2. Add some options.
      3. Change this settings:
        • [Options] "Allow choice to be updated" - Yes
        • [Results] "publish results" - Always show results to students.
        • "Privacy of results" - Publish full results, showing names and their choices.
        • "Show column for unanswered" - Yes
      4. Log in as a student and make a choice.
      5. Log back in as an admin and view the logs. Check that a 'choice choose' log is made and that no errors are shown.

      answers_updated

      1. Change to another student and make a choice, then change the choice to something else.
      2. Log back in as an admin and view the logs. Check that a 'choice choose again' log is made and that no errors are shown.

      course_module_viewed

      1. While still looking at the logs, check for "choice view".

      instances_list_viewed

      1. As a admin go to [mod/choice/index.php?id=X where 'X' is the course id.
      2. Go back to the logs and check for the following log entry "choice view all"

      report_viewed

      1. Go to the choice activity as an admin and go to the following page [Administration ► Choice administration ► View x responses].
      2. Go back to the logs and search for and find the "choice report" log.

      You're done!

      Show
      Unit tests Run the following unit tests: events_test.php generator_test.php Manual tests answers_created Create a choice activity. Add some options. Change this settings: [Options] "Allow choice to be updated" - Yes [Results] "publish results" - Always show results to students. "Privacy of results" - Publish full results, showing names and their choices. "Show column for unanswered" - Yes Log in as a student and make a choice. Log back in as an admin and view the logs. Check that a 'choice choose' log is made and that no errors are shown. answers_updated Change to another student and make a choice, then change the choice to something else. Log back in as an admin and view the logs. Check that a 'choice choose again' log is made and that no errors are shown. course_module_viewed While still looking at the logs, check for "choice view". instances_list_viewed As a admin go to [mod/choice/index.php?id=X where 'X' is the course id. Go back to the logs and check for the following log entry "choice view all" report_viewed Go to the choice activity as an admin and go to the following page [Administration ► Choice administration ► View x responses] . Go back to the logs and search for and find the "choice report" log. You're done!
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-40049-master-i
    • Story Points:
      20
    • Sprint:
      BACKEND Sprint 5

      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/choice (5 calls)
      /mod/choice/report.php:46: add_to_log($course->id, "choice", "report", "report.php?id=$cm->id", "$choice->id",$cm->id);
      /mod/choice/index.php:17: add_to_log($course->id, "choice", "view all", "index.php?id=$course->id", "");
      /mod/choice/lib.php:296: add_to_log($course->id, "choice", "choose again", "view.php?id=$cm->id", $choice->id, $cm->id);
      /mod/choice/lib.php:310: add_to_log($course->id, "choice", "choose", "view.php?id=$cm->id", $choice->id, $cm->id);
      /mod/choice/view.php:79: add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              abgreeve Adrian Greeve
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Jérôme Mouneyrac
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13