mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'MDL-65544-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
40b6e9eccf
2 changed files with 86 additions and 0 deletions
|
@ -176,6 +176,11 @@ class award_criteria_competency extends award_criteria {
|
||||||
$existing = \core_competency\user_competency_course::get_multiple($userid, $badge->courseid, $competencyids);
|
$existing = \core_competency\user_competency_course::get_multiple($userid, $badge->courseid, $competencyids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->method == BADGE_CRITERIA_AGGREGATION_ALL) {
|
||||||
|
// Any vs all conditions are reversed when no criteria let us finish early.
|
||||||
|
$overall = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->params as $param) {
|
foreach ($this->params as $param) {
|
||||||
$proficiency = false;
|
$proficiency = false;
|
||||||
foreach ($existing as $usercompetency) {
|
foreach ($existing as $usercompetency) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ Feature: Award badges based on competency completion
|
||||||
And the following lp "competencies" exist:
|
And the following lp "competencies" exist:
|
||||||
| shortname | framework |
|
| shortname | framework |
|
||||||
| comp1 | sc-y-2 |
|
| comp1 | sc-y-2 |
|
||||||
|
| comp2 | sc-y-2 |
|
||||||
And I log in as "admin"
|
And I log in as "admin"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
|
@ -79,6 +80,10 @@ Feature: Award badges based on competency completion
|
||||||
And "Competency picker" "dialogue" should be visible
|
And "Competency picker" "dialogue" should be visible
|
||||||
And I select "comp1" of the competency tree
|
And I select "comp1" of the competency tree
|
||||||
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
And I press "Add competencies to course"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp2" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
# Add a badge to the site
|
# Add a badge to the site
|
||||||
And I navigate to "Badges > Add a new badge" in site administration
|
And I navigate to "Badges > Add a new badge" in site administration
|
||||||
And I set the following fields to these values:
|
And I set the following fields to these values:
|
||||||
|
@ -94,6 +99,11 @@ Feature: Award badges based on competency completion
|
||||||
And I select "comp1" of the competency tree
|
And I select "comp1" of the competency tree
|
||||||
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
And I wait until the page is ready
|
And I wait until the page is ready
|
||||||
|
And I press "Add competency"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp2" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
And I wait until the page is ready
|
||||||
And I press "Save"
|
And I press "Save"
|
||||||
# Enable the badge
|
# Enable the badge
|
||||||
And I wait until the page is ready
|
And I wait until the page is ready
|
||||||
|
@ -113,3 +123,74 @@ Feature: Award badges based on competency completion
|
||||||
Then I log in as "user1"
|
Then I log in as "user1"
|
||||||
And I follow "Profile" in the user menu
|
And I follow "Profile" in the user menu
|
||||||
And I should see "Site Badge"
|
And I should see "Site Badge"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Award badge for completing all competencies in the site
|
||||||
|
# Add a competency to the course
|
||||||
|
When I am on "Course 1" course homepage
|
||||||
|
And I follow "Competencies"
|
||||||
|
And I press "Add competencies to course"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp1" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
And I press "Add competencies to course"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp2" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
# Add a badge to the site
|
||||||
|
And I navigate to "Badges > Add a new badge" in site administration
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Name | Site Badge |
|
||||||
|
| Description | Site badge description |
|
||||||
|
| issuername | Tester of site badge |
|
||||||
|
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||||
|
And I press "Create badge"
|
||||||
|
# Set the competency as a criteria for the badge
|
||||||
|
And I set the field "type" to "Competencies"
|
||||||
|
And I press "Add competency"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp1" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
And I wait until the page is ready
|
||||||
|
And I press "Add competency"
|
||||||
|
And "Competency picker" "dialogue" should be visible
|
||||||
|
And I select "comp2" of the competency tree
|
||||||
|
And I click on "Add" "button" in the "Competency picker" "dialogue"
|
||||||
|
And I wait until the page is ready
|
||||||
|
And I click on "This criterion is complete when" "link"
|
||||||
|
And I click on "All of the selected competencies have been completed" "radio"
|
||||||
|
And I press "Save"
|
||||||
|
# Enable the badge
|
||||||
|
And I wait until the page is ready
|
||||||
|
And I press "Enable access"
|
||||||
|
And I press "Continue"
|
||||||
|
# Rate the competency in the course
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And I follow "Competencies"
|
||||||
|
And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
|
||||||
|
And I press "Rate"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Rating | C |
|
||||||
|
And I wait until the page is ready
|
||||||
|
And I click on "Rate" "button" in the "Rate" "dialogue"
|
||||||
|
And I log out
|
||||||
|
# We should not get the badge yet.
|
||||||
|
Then I log in as "user1"
|
||||||
|
And I follow "Profile" in the user menu
|
||||||
|
And I should not see "Site Badge"
|
||||||
|
And I log out
|
||||||
|
# Rate the other competency.
|
||||||
|
And I log in as "admin"
|
||||||
|
And I am on "Course 1" course homepage
|
||||||
|
And I follow "Competencies"
|
||||||
|
And I click on "comp2" "link" in the "[data-region='coursecompetencies']" "css_element"
|
||||||
|
And I press "Rate"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Rating | C |
|
||||||
|
And I wait until the page is ready
|
||||||
|
And I click on "Rate" "button" in the "Rate" "dialogue"
|
||||||
|
And I log out
|
||||||
|
# See if we got the badge now.
|
||||||
|
Then I log in as "user1"
|
||||||
|
And I follow "Profile" in the user menu
|
||||||
|
And I should see "Site Badge"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue