Merge branch 'MDL-49923-master' of git://github.com/FMCorz/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
FM
38
39 @javascript
40 Scenario Outline: Scales can be exluded from aggregation
bed97c39 41 Given I log in as "teacher1"
37fc69a0
FM
42 And I follow "Course 1"
43 And I follow "Grades"
44 And I turn editing mode on
45 When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
46 And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
47 And I press "Save changes"
48 And I set the following settings for grade item "Course 1":
49 | Aggregation | <aggregation> |
50 And I follow "User report"
51 And I set the field "Select all or one user" to "Student 1"
52 Then the following should exist in the "user-grade" table:
53 | Grade item | Grade | Percentage | Contribution to course total |
54 | Grade me | 10.00 | 10.00 % | <gradecontrib> |
55 | Scale me | B | 75.00 % | <scalecontrib> |
56 | Course total<totalstr> | <coursetotal> | <coursepc> | - |
57 And I log out
58 And I log in as "admin"
59 And I set the following administration settings values:
60 | grade_includescalesinaggregation | 1 |
61 And I log out
62 And I log in as "teacher1"
63 And I follow "Course 1"
64 And I follow "Grades"
65 And I follow "User report"
66 And I set the field "Select all or one user" to "Student 1"
67 And the following should exist in the "user-grade" table:
68 | Grade item | Grade | Percentage | Contribution to course total |
69 | Grade me | 10.00 | 10.00 % | <gradecontrib2> |
70 | Scale me | B | 75.00 % | <scalecontrib2> |
71 | Course total<totalstr> | <coursetotal2> | <coursepc2> | - |
72
73 Examples:
08f289c6 74 | aggregation | totalstr | coursetotal | coursepc | gradecontrib | scalecontrib | coursetotal2 | coursepc2 | gradecontrib2 | scalecontrib2 |
37fc69a0
FM
75 | Natural | | 10.00 | 10.00 % | 10.00 | 0.00 | 14.00 | 13.33 % | 9.52 % | 3.81 % |
76 | Mean of grades | Mean of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
77 | Weighted mean of grades | Weighted mean of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
78 | 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 % |
79 | 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 % |
80 | Median of grades | Median of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
81 | Lowest grade | Lowest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 10.00 | 10.00 % | 10.00 % | 0.00 % |
82 | Highest grade | Highest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
83 | Mode of grades | Mode of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
84
85 @javascript
86 Scenario: Weights of scales cannot be edited when they are not aggregated
bed97c39 87 Given I log in as "teacher1"
37fc69a0
FM
88 And I follow "Course 1"
89 And I follow "Grades"
90 And I turn editing mode on
91 When I set the following settings for grade item "Course 1":
92 | Aggregation | Natural |
93 And I navigate to "Categories and items" node in "Grade administration > Setup"
94 And I set the field "Override weight of Grade me" to "1"
95 Then the field "Override weight of Grade me" matches value "100.00"
96 And I click on "Edit" "link" in the "Scale me" "table_row"
97 And I click on "Edit settings" "link" in the "Scale me" "table_row"
98 And I follow "Show more..."
99 And I should not see "Weight adjusted"
100 And I should not see "Weight"
345c6a1a 101 And the following config values are set as admin:
37fc69a0 102 | grade_includescalesinaggregation | 1 |
37fc69a0
FM
103 And I follow "Course 1"
104 And I follow "Grades"
105 And I navigate to "Categories and items" node in "Grade administration > Setup"
106 And I set the field "Override weight of Grade me" to "1"
107 And the field "Override weight of Grade me" matches value "95.238"
108 And I set the field "Override weight of Scale me" to "1"
109 And the field "Override weight of Scale me" matches value "4.8"
110 And I click on "Edit" "link" in the "Scale me" "table_row"
111 And I click on "Edit settings" "link" in the "Scale me" "table_row"
112 And I follow "Show more..."
113 And I should see "Weight adjusted"
08f289c6 114 And I should see "Weight"