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

Badge awarded should be an event

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7, 2.8
    • Fix Version/s: 2.9
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      Trigger badge award event manually issued (course context)

      1. In a existing or a new course go to Course Administration > Badges > Add a new badge.
      2. Create the badge and add the badge criteria: Manual issue by role.
      3. Check the Teacher box and select Any of the selected roles awards the badge.
      4. Click on Enable access button and confirm.
      5. Click on Award badge button under Recipients tab.
      6. Run cron: php admin/cli/cron.php
      7. Make sure the badge was generated to the user.
      8. Visit Site Administration > Reports > Logs, select the course on the first drop-down and generate the report.
      9. Make sure the Badge Awarded event was triggered and all the information is correct.

      Trigger badge award event manually issued (site context)

      1. In a existing or a new course go to Site Administration > Badges > Add a new badge.
      2. Create the badge and add the badge criteria: Manual issue by role.
      3. Check the Teacher box and select Any of the selected roles awards the badge.
      4. Click on Enable access button and confirm.
      5. Click on Award badge button under Recipients tab.
      6. Run cron: php admin/cli/cron.php
      7. Make sure the badge was generated to the user.
      8. Visit Site Administration > Reports > Logs, select site on the first drop-down and generate the report.
      9. Make sure the Badge Awarded event was triggered and all the information is correct.

      Trigger badge awarded event by activity completion

      1. Enable config: enablecompletion.
      2. Please make sure the start date of the course is before from your current date.
      3. Create or use an existing Forum and Edit settings under Activity completion tab, set Completion tracking to Show activity as complete when conditions are met and click the checkbox Require view and save.
      4. Create a badge, define the criteria to Activity completion, check the Forum checkbox, save and enable access.
      5. Log in as a user and visit the forum.
      6. Run cron: php admin/cli/cron.php
      7. Make sure the badge was generated to the user.
      8. Visit Site Administration > Reports > Logs and select the course and generate the report.
      9. Make sure the Badge Awarded event was triggered and all the information is correct.

      Trigger badge awarded event by course completion

      1. Create a course and enable Course completion in Advanced Settings.
      2. Tick Self Completion criteria on Completion tracking page
      3. Add "Self completion" block to course page
      4. Enrol user in course, login as user, complete course view the Self completion block
      5. Run cron: php admin/cli/cron.php
      6. Visit Site Administration > Reports > Logs and select the course and generate the report.
      7. Make sure the Badge Awarded event was triggered and all the information is correct.

      Unit tests.

      1. Run vendor/bin/phpunit badges/tests/events_test.php and make sure it pass.
      Show
      Trigger badge award event manually issued (course context) In a existing or a new course go to Course Administration > Badges > Add a new badge. Create the badge and add the badge criteria: Manual issue by role . Check the Teacher box and select Any of the selected roles awards the badge . Click on Enable access button and confirm. Click on Award badge button under Recipients tab. Run cron: php admin/cli/cron.php Make sure the badge was generated to the user . Visit Site Administration > Reports > Logs, select the course on the first drop-down and generate the report. Make sure the Badge Awarded event was triggered and all the information is correct. Trigger badge award event manually issued (site context) In a existing or a new course go to Site Administration > Badges > Add a new badge. Create the badge and add the badge criteria: Manual issue by role . Check the Teacher box and select Any of the selected roles awards the badge . Click on Enable access button and confirm. Click on Award badge button under Recipients tab. Run cron: php admin/cli/cron.php Make sure the badge was generated to the user . Visit Site Administration > Reports > Logs, select site on the first drop-down and generate the report. Make sure the Badge Awarded event was triggered and all the information is correct. Trigger badge awarded event by activity completion Enable config: enablecompletion . Please make sure the start date of the course is before from your current date. Create or use an existing Forum and Edit settings under Activity completion tab, set Completion tracking to Show activity as complete when conditions are met and click the checkbox Require view and save. Create a badge, define the criteria to Activity completion , check the Forum checkbox, save and enable access. Log in as a user and visit the forum. Run cron: php admin/cli/cron.php Make sure the badge was generated to the user . Visit Site Administration > Reports > Logs and select the course and generate the report. Make sure the Badge Awarded event was triggered and all the information is correct. Trigger badge awarded event by course completion Create a course and enable Course completion in Advanced Settings. Tick Self Completion criteria on Completion tracking page Add "Self completion" block to course page Enrol user in course, login as user, complete course view the Self completion block Run cron: php admin/cli/cron.php Visit Site Administration > Reports > Logs and select the course and generate the report. Make sure the Badge Awarded event was triggered and all the information is correct. Unit tests. Run vendor/bin/phpunit badges/tests/events_test.php and make sure it pass.
    • Workaround:
      Hide

      Patch supplied

      Show
      Patch supplied
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48142-master
    • Sprint:
      Team ';drop tables Sprint 3

      Description

      I was expecting "badge awarded" to be an event. For example, in the verb list "awarded" is described for this purpose ("ex:-teacher awarded student a badge.") but it doesn't exist in the list.

      My specific use case is to use this in a customisation which displays an event timeline of key configured events and a listener which awards xp (with modifiers) based on events. As we're building an event based system alongside the introduction of badges as a social learning feature it seems that these two should go together.

      I had to implement this for my project and am including the code here.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lameze Simey Lameze
              Reporter:
              jballard James Ballard
              Peer reviewer:
              Adrian Greeve Adrian Greeve
              Integrator:
              Dan Poltawski Dan Poltawski
              Tester:
              Ankit Agarwal Ankit Agarwal
              Participants:
              Component watchers:
              Yuliya Bozhko, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15