Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_grades @javascript
2
Feature: We can use calculated grade totals
3
  In order to calculate grade totals
4
  As an teacher
5
  I need to add aggregate columns to the gradebook
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | category | groupmode |
10
      | Course 1 | C1 | 0 | 1 |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email                | idnumber |
13
      | teacher1 | Teacher   | 1        | teacher1@example.com | t1       |
14
      | student1 | Student   | 1        | student1@example.com | s1       |
15
      # Additional students must be enrolled in the course to ensure that the action menu for hiding grades is displayed correctly.
16
      | student2 | Student   | 2        | student2@example.com | s2       |
17
      | student3 | Student   | 3        | student3@example.com | s3       |
18
    And the following "course enrolments" exist:
19
      | user     | course | role           |
20
      | teacher1 | C1     | editingteacher |
21
      | student1 | C1     | student        |
22
      | student2 | C1     | student        |
23
      | student3 | C1     | student        |
24
    And the following "grade categories" exist:
25
      | fullname         | course |
26
      | Sub category 1   | C1     |
27
      | Sub category 2 & | C1     |
28
    And the following "activities" exist:
29
      | activity | course | idnumber | name                  | intro             | grade |
30
      | assign   | C1     | a1       | Test assignment one & | Submit something! | 300   |
31
      | assign   | C1     | a2       | Test assignment two   | Submit something! | 100   |
32
      | assign   | C1     | a3       | Test assignment three | Submit something! | 150   |
33
      | assign   | C1     | a4       | Test assignment four  | Submit nothing!   | 150   |
34
    And the following "activities" exist:
35
      | activity | course | idnumber | name | intro | gradecategory | grade |
36
      | assign | C1 | a5 | Test assignment five | Submit something! | Sub category 1 | 20 |
37
      | assign | C1 | a6 | Test assignment six | Submit something! | Sub category 1 | 10 |
38
      | assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
39
    And the following "activities" exist:
40
      | activity | course | idnumber | name                  | intro             | gradecategory    | grade |
41
      | assign   | C1     | a8       | Test assignment eight | Submit something! | Sub category 2 & | 20    |
42
      | assign   | C1     | a9       | Test assignment nine  | Submit something! | Sub category 2 & | 10    |
43
      | assign   | C1     | 10       | Test assignment ten   | Submit nothing!   | Sub category 2 & | 15    |
44
    And I log in as "admin"
45
    And I set the following administration settings values:
46
      | 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 |
47
    And the following "grade grades" exist:
48
      | gradeitem             | user     | grade |
49
      | Test assignment one & | student1 | 60.00 |
50
      | Test assignment two   | student1 | 20.00 |
51
      | Test assignment three | student1 | 40.00 |
52
      | Test assignment five  | student1 | 10.00 |
53
      | Test assignment six   | student1 | 5.00  |
54
      | Test assignment eight | student1 | 10.00 |
55
      | Test assignment nine  | student1 | 5.00  |
56
    And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
57
    And I turn editing mode on
58
    And I change window size to "large"
59
    And I hide the grade item "Test assignment two" of type "gradeitem" on "grader" page
60
    And I hide the grade item "Test assignment five" of type "gradeitem" on "grader" page
61
    And I hide the grade item "Test assignment eight" of type "gradeitem" on "grader" page
62
    And I change window size to "medium"
63
    And I navigate to "Setup > Course grade settings" in the course gradebook
64
    And I set the field "Grade display type" to "Real (percentage)"
65
    And I press "Save changes"
66
 
67
  Scenario: Mean of grades aggregation
68
    When I navigate to "View > Grader report" in the course gradebook
69
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
70
      | Aggregation          | Mean of grades |
71
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
72
      | Aggregation          | Mean of grades |
73
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
74
      | Aggregation          | Mean of grades |
75
      | Exclude empty grades | 0              |
76
    And I turn editing mode off
77
    Then I should see "30.00 (30.00 %)" in the ".course" "css_element"
78
    And I navigate to "Setup > Course grade settings" in the course gradebook
79
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
80
    And I press "Save changes"
81
    And I log out
82
    And I log in as "student1"
83
    And I follow "Grades" in the user menu
84
    And I should see "30.42 (30.42 %)" in the "overview-grade" "table"
85
 
86
  Scenario: Weighted mean of grades aggregation
87
    When I navigate to "View > Grader report" in the course gradebook
88
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
89
      | Aggregation          | Weighted mean of grades |
90
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
91
      | Aggregation          | Weighted mean of grades |
92
      | Item weight          | 1                       |
93
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
94
      | Aggregation          | Weighted mean of grades |
95
      | Item weight          | 1                       |
96
      | Exclude empty grades | 0                       |
97
    And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
98
      | Item weight | 3 |
99
    And I turn editing mode off
100
    Then I should see "27.14 (27.14 %)" in the ".course" "css_element"
101
    And I navigate to "Setup > Course grade settings" in the course gradebook
102
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
103
    And I press "Save changes"
104
    And I log out
105
    And I log in as "student1"
106
    And I follow "Grades" in the user menu
107
    And I should see "26.94 (26.94 %)" in the "overview-grade" "table"
108
 
109
  Scenario: Simple weighted mean of grades aggregation
110
    When I navigate to "View > Grader report" in the course gradebook
111
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
112
      | Aggregation          | Simple weighted mean of grades |
113
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
114
      | Aggregation          | Simple weighted mean of grades |
115
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
116
      | Aggregation          | Simple weighted mean of grades |
117
      | Exclude empty grades | 0                              |
118
    And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
119
      | Extra credit | 1 |
120
    And I turn editing mode off
121
    Then I should see "45.19 (45.19 %)" in the ".course" "css_element"
122
    And I navigate to "Setup > Course grade settings" in the course gradebook
123
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
124
    And I press "Save changes"
125
    And I log out
126
    And I log in as "student1"
127
    And I follow "Grades" in the user menu
128
    And I should see "48.57 (48.57 %)" in the "overview-grade" "table"
129
 
130
  Scenario: Mean of grades (with extra credits) aggregation
131
    When I navigate to "View > Grader report" in the course gradebook
132
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
133
      | Aggregation          | Mean of grades (with extra credits) |
134
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
135
      | Aggregation          | Mean of grades (with extra credits) |
136
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
137
      | Aggregation          | Mean of grades (with extra credits) |
138
      | Exclude empty grades | 0                                   |
139
    And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
140
      | Extra credit weight  | 2 |
141
    And I turn editing mode off
142
    Then I should see "42.50 (42.50 %)" in the ".course" "css_element"
143
    And I navigate to "Setup > Course grade settings" in the course gradebook
144
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
145
    And I press "Save changes"
146
    And I log out
147
    And I log in as "student1"
148
    And I follow "Grades" in the user menu
149
    And I should see "47.22 (47.22 %)" in the "overview-grade" "table"
150
 
151
  Scenario: Median of grades aggregation
152
    When I navigate to "View > Grader report" in the course gradebook
153
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
154
      | Aggregation | Median of grades |
155
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
156
      | Aggregation | Median of grades |
157
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
158
      | Aggregation          | Median of grades |
159
      | Exclude empty grades | 0                |
160
    And I press "Save changes"
161
    And I turn editing mode off
162
    Then I should see "26.67 (26.67 %)" in the ".course" "css_element"
163
    And I navigate to "Setup > Course grade settings" in the course gradebook
164
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
165
    And I press "Save changes"
166
    And I log out
167
    And I log in as "student1"
168
    And I follow "Grades" in the user menu
169
    And I should see "25.83 (25.83 %)" in the "overview-grade" "table"
170
 
171
  Scenario: Lowest grade aggregation
172
    When I navigate to "View > Grader report" in the course gradebook
173
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
174
      | Aggregation | Lowest grade |
175
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
176
      | Aggregation | Lowest grade |
177
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
178
      | Aggregation          | Lowest grade |
179
      | Exclude empty grades | 0            |
180
    And I set the following settings for grade item "Test assignment five" of type "gradeitem" on "grader" page:
181
      | Hidden | 1 |
182
    And I set the following settings for grade item "Test assignment four" of type "gradeitem" on "grader" page:
183
      | Hidden | 1 |
184
    And I turn editing mode off
185
    Then I should see "0.00 (0.00 %)" in the ".course" "css_element"
186
    And I navigate to "Setup > Course grade settings" in the course gradebook
187
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
188
    And I press "Save changes"
189
    And I log out
190
    And I log in as "student1"
191
    And I follow "Grades" in the user menu
192
    And I should see "0.00 (0.00 %)" in the "overview-grade" "table"
193
 
194
  Scenario: Highest grade aggregation
195
    When I navigate to "View > Grader report" in the course gradebook
196
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
197
      | Aggregation          | Highest grade |
198
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
199
      | Aggregation          | Highest grade |
200
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
201
      | Aggregation          | Highest grade |
202
      | Exclude empty grades | 0             |
203
    And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
204
      | Hidden | 1 |
205
    And I turn editing mode off
206
    Then I should see "50.00 (50.00 %)" in the ".course" "css_element"
207
    And I navigate to "Setup > Course grade settings" in the course gradebook
208
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
209
    And I press "Save changes"
210
    And I log out
211
    And I log in as "student1"
212
    And I follow "Grades" in the user menu
213
    And I should see "50.00 (50.00 %)" in the "overview-grade" "table"
214
 
215
  Scenario: Mode of grades aggregation
216
    When I navigate to "View > Grader report" in the course gradebook
217
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
218
      | Aggregation          | Mode of grades |
219
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
220
      | Aggregation          | Mode of grades |
221
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
222
      | Aggregation          | Mode of grades |
223
      | Exclude empty grades | 0              |
224
    And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
225
      | Hidden | 1 |
226
    And I turn editing mode off
227
    Then I should see "50.00 (50.00 %)" in the ".course" "css_element"
228
    And I navigate to "Setup > Course grade settings" in the course gradebook
229
    And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
230
    And I press "Save changes"
231
    And I log out
232
    And I log in as "student1"
233
    And I follow "Grades" in the user menu
234
    And I should see "50.00 (50.00 %)" in the "overview-grade" "table"
235
 
236
  Scenario: Natural aggregation on outcome items with natural weights
237
    And the following config values are set as admin:
238
      | enableoutcomes | 1 |
239
    And the following "scales" exist:
240
      | name       | scale                                     |
241
      | Test Scale | Disappointing, Good, Very good, Excellent |
242
    And the following "grade outcomes" exist:
243
      | fullname  | shortname | course | scale      |
244
      | Outcome 1 | OT1       | C1     | Test Scale |
245
    And the following "grade items" exist:
246
      | itemname              | course | outcome | gradetype | scale      |
247
      | Test outcome item one | C1     | OT1     | Scale     | Test Scale |
248
    And I navigate to "Setup > Gradebook setup" in the course gradebook
249
    And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
250
      | Aggregation                     | Natural |
251
      | Include outcomes in aggregation | 1       |
252
      | Exclude empty grades            | 0       |
253
    And I change window size to "large"
254
    And I navigate to "View > Grader report" in the course gradebook
255
    And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
256
    And I press "Save changes"
257
    And I navigate to "Setup > Course grade settings" in the course gradebook
258
    And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
259
    And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
260
    And I press "Save changes"
261
    And I log out
262
    And I log in as "student1"
263
    And I follow "Grades" in the user menu
264
    Then I should see "114.82 (18.27 %)" in the "overview-grade" "table"
265
    And I click on "Course 1" "link" in the "region-main" "region"
266
    And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
267
    And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
268
    And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
269
      | aggregationcoef     | 1   |
270
    And I log out
271
    And I log in as "student1"
272
    And I follow "Grades" in the user menu
273
    Then I should see "114.00 (18.39 %)" in the "overview-grade" "table"
274
    And I click on "Course 1" "link" in the "region-main" "region"
275
    And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
276
    And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
277
    And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
278
      | Aggregation                     | Natural |
279
      | Include outcomes in aggregation | 0       |
280
    And I press "Save"
281
    And I log out
282
    And I log in as "student1"
283
    And I follow "Grades" in the user menu
284
    Then I should see "110.00 (17.74 %)" in the "overview-grade" "table"
285
    And I click on "Course 1" "link" in the "region-main" "region"
286
    And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
287
 
288
  Scenario: Natural aggregation on outcome items with modified weights
289
    And the following config values are set as admin:
290
      | enableoutcomes | 1 |
291
    And the following "scales" exist:
292
      | name       | scale                                     |
293
      | Test Scale | Disappointing, Good, Very good, Excellent |
294
    And the following "grade outcomes" exist:
295
      | fullname  | shortname | course | scale      |
296
      | Outcome 1 | OT1       | C1     | Test Scale |
297
    And the following "grade items" exist:
298
      | itemname              | course | outcome | gradetype | scale      |
299
      | Test outcome item one | C1     | OT1     | Scale     | Test Scale |
300
    And I navigate to "Setup > Gradebook setup" in the course gradebook
301
    And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
302
      | Aggregation                     | Natural |
303
      | Include outcomes in aggregation | 1       |
304
      | Exclude empty grades            | 0       |
305
    And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
306
      | Weight adjusted  | 1   |
307
      | aggregationcoef2 | 100 |
308
    And I change window size to "large"
309
    And I navigate to "View > Grader report" in the course gradebook
310
    And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
311
    And I press "Save changes"
312
    And I navigate to "Setup > Course grade settings" in the course gradebook
313
    And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
314
    And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
315
    And I press "Save changes"
316
    And I log out
317
    And I log in as "student1"
318
    And I follow "Grades" in the user menu
319
    Then I should see "4.00 (100.00 %)" in the "overview-grade" "table"
320
    And I click on "Course 1" "link" in the "region-main" "region"
321
    And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
322
 
323
  Scenario: Natural aggregation
324
    When I navigate to "View > Grader report" in the course gradebook
325
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
326
      | Aggregation          | Natural |
327
      | Exclude empty grades | 0       |
328
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
329
      | Aggregation          | Natural |
330
      | Exclude empty grades | 0       |
331
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
332
      | Aggregation          | Natural |
333
      | Exclude empty grades | 1       |
334
    And I set the following settings for grade item "Test assignment six" of type "gradeitem" on "grader" page:
335
      | Weight adjusted  | 1   |
336
      | aggregationcoef2 | 50  |
337
    And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "grader" page:
338
      | Extra credit | 1 |
339
    And I turn editing mode off
340
    Then I should see "152.68 (24.43 %)" in the ".course" "css_element"
341
    And I navigate to "Setup > Course grade settings" in the course gradebook
342
    And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
343
    And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
344
    And I set the field "Show contribution to course total" to "Show"
345
    And I set the field "Show weightings" to "Show"
346
    And I press "Save changes"
347
    And I navigate to "View > User report" in the course gradebook
348
    And I click on "Student 1" in the "user" search widget
349
    And I set the field "View report as" to "Myself"
350
    And the following should exist in the "user-grade" table:
351
      | Grade item | Calculated weight | Grade | Range | Contribution to course total |
352
      | Test assignment five | 28.57 % | 10.00 (50.00 %) | 0–20 | 1.03 % |
353
      | Test assignment six | 50.00 % | 5.00 (50.00 %) | 0–10 | 1.80 % |
354
      | Test assignment seven | 21.43 % | - | 0–15 | 0.00 % |
355
      | Test assignment eight | 66.67 % | 10.00 (50.00 %) | 0–20 | 1.60 % |
356
      | Test assignment nine | 33.33 % | 5.00 (50.00 %) | 0–10 | 0.80 % |
357
      | Test assignment ten | 0.00 %( Empty ) | - | 0–15 | 0.00 % |
358
      | Test assignment one & | 48.00 % | 60.00 (20.00 %) | 0–300 | 9.60 % |
359
      | Test assignment two | 16.00 % | 20.00 (20.00 %) | 0–100 | 3.20 % |
360
      | Test assignment three | 24.00 %( Extra credit ) | 40.00 (26.67 %) | 0–150 | 6.40 % |
361
      | Test assignment four | 24.00 % | - | 0–150 | 0.00 % |
362
    And I log out
363
    And I log in as "student1"
364
    And I follow "Grades" in the user menu
365
    And I should see "113.75 (23.45 %)" in the "overview-grade" "table"
366
    And I click on "Course 1" "link" in the "region-main" "region"
367
    And the following should exist in the "user-grade" table:
368
      | Grade item | Calculated weight | Grade | Range | Contribution to course total |
369
      | Test assignment six | 70.00 % | 5.00 (50.00 %) | 0–10 | 1.80 % |
370
      | Test assignment seven | 30.00 % | - | 0–15 | 0.00 % |
371
      | Test assignment nine | 100.00 % | 5.00 (50.00 %) | 0–10 | 1.03 % |
372
      | Test assignment ten | -( Empty ) | - | 0–15 | - |
373
      | Test assignment one & | 61.86 % | 60.00 (20.00 %) | 0–300 | 12.37 % |
374
      | Test assignment three | 30.93 %( Extra credit ) | 40.00 (26.67 %) | 0–150 | 8.25 % |
375
      | Test assignment four | 30.93 % | - | 0–150 | 0.00 % |
376
 
377
  Scenario: Natural aggregation with drop lowest
378
    When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
379
    And I turn editing mode on
380
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
381
      | Aggregation          | Natural |
382
      | Exclude empty grades | 0       |
383
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
384
      | Aggregation          | Natural |
385
      | Exclude empty grades | 0       |
386
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
387
      | Aggregation          | Natural |
388
      | Exclude empty grades | 0       |
389
    And I navigate to "Setup > Gradebook setup" in the course gradebook
390
    And I choose the "Add category" item in the "Add" action menu
391
    And I set the following fields to these values:
392
      | Category name | Sub category 3 |
393
      | Aggregation | Natural |
394
      | Drop the lowest | 1 |
395
    And I click on "Save" "button" in the "New category" "dialogue"
396
    And I wait until the page is ready
397
    And I choose the "Add grade item" item in the "Add" action menu
398
    And I set the following fields to these values:
399
      | Item name | Manual item 1 |
400
      | Grade category | Sub category 3 |
401
    And I click on "Save" "button" in the "New grade item" "dialogue"
402
    And I choose the "Add grade item" item in the "Add" action menu
403
    And I set the following fields to these values:
404
      | Item name | Manual item 2 |
405
      | Grade category | Sub category 3 |
406
    And I click on "Save" "button" in the "New grade item" "dialogue"
407
    And I choose the "Add grade item" item in the "Add" action menu
408
    And I set the following fields to these values:
409
      | Item name | Manual item 3 |
410
      | Grade category | Sub category 3 |
411
    And I click on "Save" "button" in the "New grade item" "dialogue"
412
    And I navigate to "View > Grader report" in the course gradebook
413
    And I give the grade "60.00" to the user "Student 1" for the grade item "Manual item 1"
414
    And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
415
    And I give the grade "40.00" to the user "Student 1" for the grade item "Manual item 3"
416
    And I press "Save changes"
417
    And I turn editing mode off
418
    Then I should see "250.00 (25.25 %)" in the ".course" "css_element"
419
    And I turn editing mode on
420
    And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
421
      | Extra credit | 1 |
422
    And I turn editing mode off
423
    And I should see "270.00 (27.27 %)" in the ".course" "css_element"
424
    And I turn editing mode on
425
    And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
426
      | Rescale existing grades | No |
427
      | Maximum grade | 200 |
428
      | Extra credit  | 0   |
429
    # Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
430
    And I change window size to "5120x2160"
431
    And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
432
    And I press "Save changes"
433
    And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
434
    And I press "Save changes"
435
    And I turn editing mode off
436
    And I should see "270.00 (22.69 %)" in the ".course" "css_element"
437
    And I turn editing mode on
438
    And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
439
      | Rescale existing grades | No |
440
      | Maximum grade | 100 |
441
      | Extra credit  | 0   |
442
    # Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
443
    And I change window size to "5120x2160"
444
    And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
445
    And I press "Save changes"
446
    And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
447
    And I press "Save changes"
448
    And I turn editing mode off
449
    And I should see "250.00 (25.25 %)" in the ".course" "css_element"
450
    And I navigate to "Setup > Gradebook setup" in the course gradebook
451
    And I choose the "Add category" item in the "Add" action menu
452
    And I set the following fields to these values:
453
      | Category name | Sub sub category 1 |
454
      | Parent category | Sub category 3 |
455
    And I click on "Save" "button" in the "New category" "dialogue"
456
    And I wait until the page is ready
457
    And I navigate to "View > Grader report" in the course gradebook
458
    And I should see "270.00 (24.77 %)" in the ".course" "css_element"
459
 
460
  Scenario: Natural aggregation from the setup screen
461
    When I navigate to "Setup > Gradebook setup" in the course gradebook
462
    And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
463
      | Aggregation          | Natural |
464
    And I set the following settings for grade item "Sub category 1" of type "category" on "setup" page:
465
      | Aggregation          | Natural |
466
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "setup" page:
467
      | Aggregation          | Natural |
468
    And the field "Weight of Test assignment one &" matches value "37.975"
469
    And the field "Weight of Test assignment two" matches value "12.658"
470
    And the field "Weight of Sub category 1" matches value "5.696"
471
    And the field "Weight of Sub category 2" matches value "5.696"
472
    And I set the field "Override weight of Test assignment one &" to "1"
473
    And I set the field "Weight of Test assignment one &" to "10"
474
    And the field "Weight of Test assignment two" matches value "18.367"
475
    And the field "Weight of Sub category 1" matches value "8.265"
476
    And the field "Weight of Sub category 2" matches value "8.265"
477
    And I set the field "Override weight of Test assignment two" to "1"
478
    And I set the field "Override weight of Test assignment two" to "0"
479
    And the field "Weight of Test assignment six" matches value "22.222"
480
    And I set the field "Override weight of Test assignment six" to "1"
481
    And I set the field "Weight of Test assignment six" to "50"
482
    And I set the field "Override weight of Test assignment six" to "0"
483
    And the field "Weight of Test assignment six" matches value "22.222"
484
    And the field "Weight of Test assignment ten" matches value "33.333"
485
    And I set the field "Override weight of Test assignment ten" to "1"
486
    And I set the field "Weight of Test assignment ten" to "50"
487
    And I set the field "Override weight of Sub category 1" to "1"
488
    And I set the field "Weight of Sub category 1" to "15"
489
    Then the field "Weight of Test assignment one &" matches value "10.0"
490
    And the field "Weight of Test assignment two" matches value "16.854"
491
    And the field "Weight of Test assignment six" matches value "22.222"
492
    And the field "Weight of Test assignment ten" matches value "50.0"
493
    And the field "Weight of Sub category 1" matches value "15.0"
494
    And I press "Save changes"
495
    Then the field "Weight of Test assignment one &" matches value "10.0"
496
    And the field "Weight of Test assignment two" matches value "16.854"
497
    And the field "Weight of Test assignment six" matches value "22.222"
498
    And the field "Weight of Test assignment ten" matches value "50.0"
499
    And the field "Weight of Sub category 1" matches value "15.0"
500
    And I set the field "Override weight of Test assignment one &" to "0"
501
    And I set the field "Override weight of Test assignment two" to "0"
502
    And I set the field "Override weight of Test assignment six" to "0"
503
    And I set the field "Override weight of Sub category 1" to "0"
504
    And the field "Weight of Test assignment one &" matches value "37.975"
505
    And the field "Weight of Sub category 1" matches value "5.696"
506
    And I press "Save changes"
507
    And the field "Weight of Test assignment one &" matches value "37.975"
508
    And the field "Weight of Sub category 1" matches value "5.696"
509
    And I reset weights for grade category "Sub category 2 &"
510
    And the field "Weight of Test assignment ten" matches value "33.333"
511
 
512
  Scenario: Natural aggregation with weights of zero
513
    When I navigate to "View > Grader report" in the course gradebook
514
    And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
515
      | Aggregation          | Natural |
516
      | Exclude empty grades | 0       |
517
    And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
518
      | Aggregation          | Natural |
519
      | Exclude empty grades | 0       |
520
    And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
521
      | Aggregation          | Natural |
522
      | Exclude empty grades | 0       |
523
    And I turn editing mode off
524
    And I navigate to "Setup > Gradebook setup" in the course gradebook
525
    And "//span[@class='grateitemheader'][@title='Sub category 2 &']" "xpath_element" should not exist
526
    And "//span[@class='grateitemheader'][@title='Link to Test assignment one & Assignment']" "xpath_element" should not exist
527
    And I set the field "Override weight of Test assignment one &" to "1"
528
    And I set the field "Weight of Test assignment one &" to "0"
529
    And I should see "490.00" in the "Course total" "table_row"
530
    And I set the field "Override weight of Test assignment six" to "1"
531
    And I set the field "Weight of Test assignment six" to "0"
532
    And I should see "480.00" in the "Course total" "table_row"
533
    And I set the field "Override weight of Test assignment nine" to "1"
534
    And I set the field "Weight of Test assignment nine" to "100"
535
    And I press "Save changes"
536
    And I navigate to "Setup > Course grade settings" in the course gradebook
537
    And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
538
    And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
539
    And I set the field "Show contribution to course total" to "Show"
540
    And I set the field "Show weightings" to "Show"
541
    And I press "Save changes"
542
    And I navigate to "View > Grader report" in the course gradebook
543
    Then I should see "75.00 (16.85 %)" in the ".course" "css_element"
544
    And I navigate to "View > User report" in the course gradebook
545
    And I click on "Student 1" in the "user" search widget
546
    And I set the field "View report as" to "Myself"
547
    And the following should exist in the "user-grade" table:
548
      | Grade item            | Calculated weight | Grade           | Contribution to course total |
549
      | Test assignment five  | 57.14 %           | 10.00 (50.00 %) | 2.25 %                        |
550
      | Test assignment six   | 0.00 %            | 5.00 (50.00 %)  | 0.00 %                        |
551
      | Test assignment seven | 42.86 %           | -               | 0.00 %                        |
552
      | Test assignment eight | 0.00 %            | 10.00 (50.00 %) | 0.00 %                        |
553
      | Test assignment nine  | 100.00 %          | 5.00 (50.00 %)  | 1.12 %                         |
554
      | Test assignment ten   | 0.00 %            | -               | 0.00 %                         |
555
      | Test assignment one & | 0.00 %            | 60.00 (20.00 %) | 0.00 %                         |
556
      | Test assignment two   | 22.47 %           | 20.00 (20.00 %) | 4.49 %                        |
557
      | Test assignment three | 33.71 %           | 40.00 (26.67 %) | 8.99 %                        |
558
      | Test assignment four  | 33.71 %           | -               | 0.00                         |
559
    And I log out
560
    And I log in as "student1"
561
    And I follow "Grades" in the user menu
562
    And I should see "45.00 (13.85 %)" in the "overview-grade" "table"
563
    And I click on "Course 1" "link" in the "region-main" "region"
564
    And the following should exist in the "user-grade" table:
565
      | Grade item            | Calculated weight | Grade           | Contribution to course total |
566
      | Test assignment six   | 0.00 %            | 5.00 (50.00 %)  | 0.00 %                         |
567
      | Test assignment seven | 100.00 %          | -               | 0.00 %                         |
568
      | Test assignment nine  | 100.00 %          | 5.00 (50.00 %)  | 1.54 %                         |
569
      | Test assignment ten   | 0.00              | -               | 0.00 %                         |
570
      | Test assignment one & | 0.00 %            | 60.00 (20.00 %) | 0.00 %                         |
571
      | Test assignment three | 46.15 %           | 40.00 (26.67 %) | 12.31 %                        |
572
      | Test assignment four  | 46.15 %           | -               | 0.00 %                        |