Merge branch 'wip-mdl-49324' of https://github.com/rajeshtaneja/moodle
[moodle.git] / grade / tests / behat / grade_scales_aggregation.feature
CommitLineData
37fc69a0
FM
1@core @core_grades
2Feature: Control the aggregation of the scales
3 In order to use control the aggregation of the scales
4 As an admin
5 I can change use administration setting
6
7 Background:
8 Given the following "courses" exist:
9 | fullname | shortname |
10 | Course 1 | C1 |
11 And the following "users" exist:
12 | username | firstname | lastname | email | idnumber |
0fe86bbd
RT
13 | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
14 | student1 | Student | 1 | student1@example.com | s1 |
37fc69a0
FM
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And I log in as "admin"
20 And I set the following administration settings values:
21 | grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
22 | grade_report_user_showcontributiontocoursetotal | 1 |
23 And I navigate to "Scales" node in "Site administration > Grades"
24 And I press "Add a new scale"
25 And I set the following fields to these values:
26 | Name | Letterscale |
27 | Scale | F,D,C,B,A |
28 And I press "Save changes"
29 And the following "grade items" exist:
30 | itemname | course |
31 | Grade me | C1 |
32 And the following "grade items" exist:
33 | itemname | course | scale |
34 | Scale me | C1 | Letterscale |
345c6a1a 35 And the following config values are set as admin:
bed97c39
RT
36 | grade_includescalesinaggregation | 0 |
37 And I log out
37fc69a0 38
a3dd8be7 39 Scenario Outline: Scales can be excluded from aggregation
bed97c39 40 Given I log in as "teacher1"
37fc69a0 41 And I follow "Course 1"
4887d152 42 And I navigate to "Grades" node in "Course administration"
37fc69a0
FM
43 And I turn editing mode on
44 When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
45 And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
46 And I press "Save changes"
47 And I set the following settings for grade item "Course 1":
48 | Aggregation | <aggregation> |
49 And I follow "User report"
2b9361cd 50 And I select "Student 1" from the "Select all or one user" singleselect
37fc69a0
FM
51 Then the following should exist in the "user-grade" table:
52 | Grade item | Grade | Percentage | Contribution to course total |
53 | Grade me | 10.00 | 10.00 % | <gradecontrib> |
54 | Scale me | B | 75.00 % | <scalecontrib> |
55 | Course total<totalstr> | <coursetotal> | <coursepc> | - |
56 And I log out
57 And I log in as "admin"
58 And I set the following administration settings values:
59 | grade_includescalesinaggregation | 1 |
60 And I log out
61 And I log in as "teacher1"
62 And I follow "Course 1"
4887d152 63 And I navigate to "Grades" node in "Course administration"
37fc69a0 64 And I follow "User report"
2b9361cd 65 And I select "Student 1" from the "Select all or one user" singleselect
37fc69a0
FM
66 And the following should exist in the "user-grade" table:
67 | Grade item | Grade | Percentage | Contribution to course total |
68 | Grade me | 10.00 | 10.00 % | <gradecontrib2> |
69 | Scale me | B | 75.00 % | <scalecontrib2> |
70 | Course total<totalstr> | <coursetotal2> | <coursepc2> | - |
71
72 Examples:
08f289c6 73 | aggregation | totalstr | coursetotal | coursepc | gradecontrib | scalecontrib | coursetotal2 | coursepc2 | gradecontrib2 | scalecontrib2 |
37fc69a0
FM
74 | Natural | | 10.00 | 10.00 % | 10.00 | 0.00 | 14.00 | 13.33 % | 9.52 % | 3.81 % |
75 | Mean of grades | Mean of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
76 | Weighted mean of grades | Weighted mean of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
77 | Simple weighted mean of grades | Simple weighted mean of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 12.50 | 12.50 % | 9.62 % | 2.88 % |
78 | Mean of grades (with extra credits) | Mean of grades (with extra credits). | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
79 | Median of grades | Median of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
80 | Lowest grade | Lowest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 10.00 | 10.00 % | 10.00 % | 0.00 % |
81 | Highest grade | Highest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
82 | Mode of grades | Mode of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
83
84 @javascript
85 Scenario: Weights of scales cannot be edited when they are not aggregated
bed97c39 86 Given I log in as "teacher1"
37fc69a0 87 And I follow "Course 1"
4887d152 88 And I navigate to "Grades" node in "Course administration"
37fc69a0
FM
89 And I turn editing mode on
90 When I set the following settings for grade item "Course 1":
91 | Aggregation | Natural |
53914e44 92 And I navigate to "Gradebook setup" node in "Grade administration > Setup"
37fc69a0
FM
93 And I set the field "Override weight of Grade me" to "1"
94 Then the field "Override weight of Grade me" matches value "100.00"
95 And I click on "Edit" "link" in the "Scale me" "table_row"
96 And I click on "Edit settings" "link" in the "Scale me" "table_row"
97 And I follow "Show more..."
98 And I should not see "Weight adjusted"
99 And I should not see "Weight"
345c6a1a 100 And the following config values are set as admin:
37fc69a0 101 | grade_includescalesinaggregation | 1 |
37fc69a0 102 And I follow "Course 1"
4887d152 103 And I navigate to "Grades" node in "Course administration"
53914e44 104 And I navigate to "Gradebook setup" node in "Grade administration > Setup"
37fc69a0
FM
105 And I set the field "Override weight of Grade me" to "1"
106 And the field "Override weight of Grade me" matches value "95.238"
107 And I set the field "Override weight of Scale me" to "1"
108 And the field "Override weight of Scale me" matches value "4.8"
109 And I click on "Edit" "link" in the "Scale me" "table_row"
110 And I click on "Edit settings" "link" in the "Scale me" "table_row"
111 And I follow "Show more..."
112 And I should see "Weight adjusted"
08f289c6 113 And I should see "Weight"