MDL-48618 grades: Testing calculated items with minmaxtouse
[moodle.git] / grade / tests / behat / grade_minmax.feature
CommitLineData
597fc6db
FM
1@core @core_grades
2Feature: We can choose what min or max grade to use when aggregating grades.
3 In order to what min or max grade to use
4 As an teacher
5 I can update modify a course setting
6
7 @javascript
8 Scenario: Changing the min or max grade to use updates the grades accordingly
9 Given the following "courses" exist:
10 | fullname | shortname | category | groupmode |
11 | C1 | C1 | 0 | 1 |
12 And the following "users" exist:
13 | username | firstname | lastname | email | idnumber |
14 | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
15 | student1 | Student | 1 | student1@example.com | s1 |
16 | student2 | Student | 2 | student2@example.com | s2 |
17 And the following "course enrolments" exist:
18 | user | course | role |
19 | teacher1 | C1 | editingteacher |
20 | student1 | C1 | student |
21 | student2 | C1 | student |
22 And the following "grade categories" exist:
23 | fullname | course |
24 | CAT1 | C1 |
25 And I log in as "admin"
26 And I set the following administration settings values:
27 | grade_minmaxtouse | Min and max grades as specified in grade item settings |
28 And I am on site homepage
29 And I follow "C1"
30 And I navigate to "Grades" node in "Course administration"
31 And I navigate to "Categories and items" node in "Grade administration > Setup"
32 And I press "Add grade item"
33 And I set the following fields to these values:
34 | Item name | MI 1 |
35 | Grade category | C1 |
36 And I press "Save changes"
37 And I press "Add grade item"
38 And I set the following fields to these values:
39 | Item name | MI 2 |
40 | Grade category | C1 |
41 And I press "Save changes"
42 And I press "Add grade item"
43 And I set the following fields to these values:
44 | Item name | MI 3 |
45 | Grade category | CAT1 |
46 And I press "Save changes"
47 And I press "Add grade item"
48 And I set the following fields to these values:
49 | Item name | MI 4 |
50 | Grade category | CAT1 |
51 And I press "Save changes"
12a4770d
DM
52 And I press "Add grade item"
53 And I set the following fields to these values:
54 | Item name | MI 5 |
55 | Grade category | C1 |
56 And I press "Save changes"
57 And I set "=[[mi1]]+[[mi2]]+[[mi3]]" calculation for grade item "MI 5" with idnumbers:
58 | MI 1 | mi1 |
59 | MI 2 | mi2 |
60 | MI 3 | mi3 |
597fc6db
FM
61 And I navigate to "Course grade settings" node in "Grade administration > Setup"
62 And I set the field "Min and max grades used in calculation" to "Default (Min and max grades as specified in grade item settings)"
63 And I set the field "Show weightings" to "Show"
64 And I set the field "Show contribution to course total" to "Show"
65 And I press "Save changes"
66 And I navigate to "Categories and items" node in "Grade administration > Setup"
67 And I set the following settings for grade item "CAT1":
68 | Aggregation | Natural |
69 And I log out
70 And I log in as "teacher1"
71 And I follow "C1"
72 And I navigate to "Grades" node in "Course administration"
73 And I turn editing mode on
74 And I give the grade "75.00" to the user "Student 1" for the grade item "MI 1"
75 And I give the grade "25.00" to the user "Student 1" for the grade item "MI 2"
76 And I give the grade "50.00" to the user "Student 1" for the grade item "MI 3"
77 And I give the grade "100.00" to the user "Student 1" for the grade item "MI 4"
78 And I give the grade "20.00" to the user "Student 2" for the grade item "MI 1"
79 And I give the grade "10.00" to the user "Student 2" for the grade item "MI 3"
80 And I press "Save changes"
81 And I follow "User report"
82 And I select "Student 1" from the "Select all or one user" singleselect
83 And the following should exist in the "user-grade" table:
84 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d
DM
85 | MI 1 | 20.00 % | 75.00 | 0–100 | 75.00 % | 15.00 % |
86 | MI 2 | 20.00 % | 25.00 | 0–100 | 25.00 % | 5.00 % |
87 | MI 3 | 50.00 % | 50.00 | 0–100 | 50.00 % | 10.00 % |
88 | MI 4 | 50.00 % | 100.00 | 0–100 | 100.00 % | 20.00 % |
89 | MI 5 | 20.00 % | 100.00 | 0–100 | 100.00 % | 20.00 % |
90 | CAT1 total | 40.00 % | 150.00 | 0–200 | 75.00 % | - |
91 | Course total | - | 350.00 | 0–500 | 70.00 % | - |
597fc6db
FM
92 And I select "Student 2" from the "Select all or one user" singleselect
93 And the following should exist in the "user-grade" table:
94 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d 95 | MI 1 | 33.33 % | 20.00 | 0–100 | 20.00 % | 6.67 % |
597fc6db 96 | MI 2 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d 97 | MI 3 | 100.00 % | 10.00 | 0–100 | 10.00 % | 3.33 % |
597fc6db 98 | MI 4 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d
DM
99 | MI 5 | 33.33 % | 30.00 | 0–100 | 30.00 % | 10.00 % |
100 | CAT1 total | 33.33 % | 10.00 | 0–100 | 10.00 % | - |
101 | Course total | - | 60.00 | 0–300 | 20.00 % | - |
597fc6db
FM
102 And I navigate to "Categories and items" node in "Grade administration > Setup"
103 And I set the following settings for grade item "MI 1":
104 | Maximum grade | 50.00 |
105 | Minimum grade | 5.00 |
106 And I set the following settings for grade item "MI 3":
107 | Maximum grade | 50.00 |
108 | Minimum grade | 5.00 |
109 And I follow "User report"
110 And I select "Student 1" from the "Select all or one user" singleselect
111 And the following should exist in the "user-grade" table:
112 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d
DM
113 | MI 1 | 12.50 % | 75.00 | 5–50 | 100.00 % | 18.75 % |
114 | MI 2 | 25.00 % | 25.00 | 0–100 | 25.00 % | 6.25 % |
115 | MI 3 | 33.33 % | 50.00 | 5–50 | 100.00 % | 12.50 % |
116 | MI 4 | 66.67 % | 100.00 | 0–100 | 100.00 % | 25.00 % |
117 | MI 5 | 25.00 % | 100.00 | 0–100 | 100.00 % | 25.00 % |
118 | CAT1 total | 37.50 % | 150.00 | 0–150 | 100.00 % | - |
119 | Course total | - | 350.00 | 0–400 | 87.50 % | - |
597fc6db
FM
120 And I select "Student 2" from the "Select all or one user" singleselect
121 And the following should exist in the "user-grade" table:
122 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d 123 | MI 1 | 25.00 % | 20.00 | 5–50 | 33.33 % | 10.00 % |
597fc6db 124 | MI 2 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d 125 | MI 3 | 100.00 % | 10.00 | 5–50 | 11.11 % | 5.00 % |
597fc6db 126 | MI 4 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d
DM
127 | MI 5 | 50.00 % | 30.00 | 0–100 | 30.00 % | 15.00 % |
128 | CAT1 total | 25.00 % | 10.00 | 0–50 | 20.00 % | - |
129 | Course total | - | 60.00 | 0–200 | 30.00 % | - |
130 And I navigate to "Categories and items" node in "Grade administration > Setup"
131 And I set the following settings for grade item "MI 5":
132 | Maximum grade | 200.00 |
133 And I follow "User report"
134 And I select "Student 1" from the "Select all or one user" singleselect
135 And the following should exist in the "user-grade" table:
136 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
137 | MI 5 | 40.00 % | 150.00 | 0–200 | 75.00 % | 30.00 % |
138 | Course total | - | 400.00 | 0–500 | 80.00 % | - |
139 And I select "Student 2" from the "Select all or one user" singleselect
140 And the following should exist in the "user-grade" table:
141 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
142 | MI 5 | 66.67 % | 30.00 | 0–200 | 15.00 % | 10.00 % |
143 | Course total | - | 60.00 | 0–300 | 20.00 % | - |
597fc6db
FM
144 And I navigate to "Course grade settings" node in "Grade administration > Setup"
145 When I set the field "Min and max grades used in calculation" to "Initial min and max grades"
146 And I press "Save changes"
147 And I follow "User report"
148 And I select "Student 1" from the "Select all or one user" singleselect
149 Then the following should exist in the "user-grade" table:
150 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d
DM
151 | MI 1 | 20.00 % | 75.00 | 0–100 | 75.00 % | 15.00 % |
152 | MI 2 | 20.00 % | 25.00 | 0–100 | 25.00 % | 5.00 % |
153 | MI 3 | 50.00 % | 50.00 | 0–100 | 50.00 % | 10.00 % |
154 | MI 4 | 50.00 % | 100.00 | 0–100 | 100.00 % | 20.00 % |
155 | MI 5 | 20.00 % | 150.00 | 0–100 | 100.00 % | 30.00 % |
156 | CAT1 total | 40.00 % | 150.00 | 0–200 | 75.00 % | - |
157 | Course total | - | 400.00 | 0–500 | 80.00 % | - |
597fc6db
FM
158 And I select "Student 2" from the "Select all or one user" singleselect
159 And the following should exist in the "user-grade" table:
160 | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
12a4770d 161 | MI 1 | 33.33 % | 20.00 | 0–100 | 20.00 % | 6.67 % |
597fc6db 162 | MI 2 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d 163 | MI 3 | 100.00 % | 10.00 | 0–100 | 10.00 % | 3.33 % |
597fc6db 164 | MI 4 | 0.00 % | - | 0–100 | - | 0.00 % |
12a4770d
DM
165 | MI 5 | 33.33 % | 30.00 | 0–100 | 30.00 % | 10.00 % |
166 | CAT1 total | 33.33 % | 10.00 | 0–100 | 10.00 % | - |
167 | Course total | - | 60.00 | 0–300 | 20.00 % | - |