-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.6, 3.6, 3.7, 3.8
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
MDL-66032-master_awarded_badges_criteria -
Currently, it is possible to add the 'Awarded badges' criterion to a new badge without attaching any badges. This causes an exception to be thrown when activating the badge, and when the badge cron task is run.
It is also possible to add the 'Awarded badges' criterion with badges attached and then afterwards remove all of the badges.
If a badge has the 'awarded badges' criteria without any badges associated, it is equivalent to not having the criteria at all. The criteria should not be able to be created without badges selected, or edited so that no badges are selected. However, no exception should be thrown for badges that have an 'empty list' for this criteria.
To reproduce the issue:
Setup
- Login as an admin user.
- GOTO Site Administration->Development->Make test course
- Name it whatever you like, and select S (small) for the size.
- Click 'create course'
- GOTO Site Administration->SCROLL to Badges->CLICK Add a new badge.
- Name it 'Valid Badge' and give it any description, icon and issuer.
- CLICK the dropdown to add criteria, and select 'Manual issue by role'
- Select any of the roles and click save
- Click 'Enable Access'
- Click 'Continue' on Changes to badge access pop up.
- The badge should have been created without any errors. (This badge will be used later)
Create badge without criteria
- GOTO Site Administration->SCROLL to Badges->CLICK Add a new badge.
- Name it 'Empty Award Badge' and give it any description, icon and issuer.
- CLICK the dropdown to add criteria, and select 'Awarded badges'
# CLICK Save without selecting anything else. Note that at least one other badge must have already been created and activated. - CLICK 'Enable Access'
- CLICK 'Continue' on Changes to badge access pop up.
- Verify that an sql exception has been thrown.
Create badge with valid 'awarded badges' criteria, then remove prerequisite badges
- GOTO Site Administration->SCROLL to Badges->CLICK Add a new badge.
- Name it 'Removed Award Badge' and give it any description, icon and issuer.
- CLICK the dropdown to add criteria, and select 'Awarded badges'
- CLICK on 'Valid Badge' in the list. (Created in setup)
- CLICK Save.
- CLICK on the gear wheel next to the 'Awarded badges' criteria to open settings.
- CTRL-CLICK on the 'Valid Badge' in the list.
- CLICK Save.
- CLICK 'Enable Access'
- CLICK 'Continue' on Changes to badge access pop up.
- Verify that an sql exception has been thrown.
- has a non-specific relationship to
-
MDL-66160 Badge award criteria not considering ALL required badges
- Open