/grade/tests/behat/grade_natural_exclude_empty_20150619.feature

https://gitlab.com/unofficial-mirrors/moodle · Gherkin Specification · 274 lines · 259 code · 11 blank · 4 comment · 6 complexity · 0940acc46bfcd121299b754160bfb0b8 MD5 · raw file

  1. @core @core_grades
  2. Feature: Gradebook calculations for extra credit items before the fix 20150619
  3. In order to make sure the grades are not changed after upgrade
  4. As a teacher
  5. I need to be able to freeze gradebook calculations
  6. Background:
  7. Given the following "courses" exist:
  8. | fullname | shortname | category | groupmode |
  9. | Course 1 | C1 | 0 | 1 |
  10. And gradebook calculations for the course "C1" are frozen at version "20150619"
  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. And the following "course enrolments" exist:
  16. | user | course | role |
  17. | teacher1 | C1 | editingteacher |
  18. | student1 | C1 | student |
  19. And the following "activities" exist:
  20. | activity | course | idnumber | name | intro | grade |
  21. | assign | C1 | a1 | Test assignment one | x | 100 |
  22. | assign | C1 | a2 | Test assignment two | x | 50 |
  23. | assign | C1 | a3 | Test assignment three | x | 200 |
  24. | assign | C1 | a4 | Test assignment four (extra) | x | 20 |
  25. | assign | C1 | a5 | Test assignment five (extra) | x | 10 |
  26. And I log in as "teacher1"
  27. And I am on "Course 1" course homepage
  28. And I navigate to "Setup > Gradebook setup" in the course gradebook
  29. And I set the following settings for grade item "Test assignment four (extra)":
  30. | Extra credit | 1 |
  31. And I set the following settings for grade item "Test assignment five (extra)":
  32. | Extra credit | 1 |
  33. @javascript
  34. Scenario: No weights are overridden and student has all grades present (before the fix 20150619)
  35. When I navigate to "View > Grader report" in the course gradebook
  36. And I turn editing mode on
  37. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  38. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  39. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  40. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  41. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  42. And I press "Save changes"
  43. And I navigate to "View > User report" in the course gradebook
  44. And I set the field "Select all or one user" to "Student 1"
  45. Then the following should exist in the "user-grade" table:
  46. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  47. | Test assignment one | 28.57 % | 80.00 | 0100 | 80.00 % | 22.86 % |
  48. | Test assignment two | 14.29 % | 30.00 | 050 | 60.00 % | 8.57 % |
  49. | Test assignment three | 57.14 % | 150.00 | 0200 | 75.00 % | 42.86 % |
  50. | Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
  51. | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
  52. | Course total | - | 278.00 | 0350 | 79.43 % | - |
  53. And I log out
  54. @javascript
  55. Scenario: No weights are overridden, student has some grades present (before the fix 20150619)
  56. When I navigate to "View > Grader report" in the course gradebook
  57. And I turn editing mode on
  58. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  59. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  60. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  61. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  62. And I press "Save changes"
  63. And I navigate to "View > User report" in the course gradebook
  64. And I set the field "Select all or one user" to "Student 1"
  65. Then the following should exist in the "user-grade" table:
  66. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  67. | Test assignment one | 66.67 % | 80.00 | 0100 | 80.00 % | 53.33 % |
  68. | Test assignment two | 33.33 % | 30.00 | 050 | 60.00 % | 20.00 % |
  69. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  70. | Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
  71. | Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
  72. | Course total | - | 128.00 | 0150 | 85.33 % | - |
  73. And I log out
  74. @javascript
  75. Scenario: No weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
  76. When I navigate to "View > Grader report" in the course gradebook
  77. And I turn editing mode on
  78. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  79. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  80. And I press "Save changes"
  81. And I navigate to "View > User report" in the course gradebook
  82. And I set the field "Select all or one user" to "Student 1"
  83. Then the following should exist in the "user-grade" table:
  84. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  85. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  86. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  87. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  88. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  89. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  90. | Course total | - | 0.00 | 00 | | - |
  91. And I log out
  92. @javascript
  93. Scenario: Make sure there are no errors when all items are marked as extra credit (before the fix 20150619)
  94. And I set the following settings for grade item "Test assignment one":
  95. | Extra credit | 1 |
  96. And I set the following settings for grade item "Test assignment two":
  97. | Extra credit | 1 |
  98. And I set the following settings for grade item "Test assignment three":
  99. | Extra credit | 1 |
  100. When I navigate to "View > Grader report" in the course gradebook
  101. And I turn editing mode on
  102. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  103. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  104. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  105. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  106. And I press "Save changes"
  107. And I navigate to "View > User report" in the course gradebook
  108. And I set the field "Select all or one user" to "Student 1"
  109. Then the following should exist in the "user-grade" table:
  110. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  111. | Test assignment one | 0.00 %( Extra credit ) | 80.00 | 0100 | 80.00 % | 0.00 % |
  112. | Test assignment two | 0.00 %( Extra credit ) | 30.00 | 050 | 60.00 % | 0.00 % |
  113. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  114. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  115. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  116. | Course total | - | 0.0 | 00 | | - |
  117. And I log out
  118. @javascript
  119. Scenario: Weights are overridden and student has all grades present (before the fix 20150619)
  120. When I set the field "Override weight of Test assignment one" to "1"
  121. And I set the field "Weight of Test assignment one" to "50"
  122. And I press "Save changes"
  123. When I navigate to "View > Grader report" in the course gradebook
  124. And I turn editing mode on
  125. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  126. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  127. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  128. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  129. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  130. And I press "Save changes"
  131. And I navigate to "View > User report" in the course gradebook
  132. And I set the field "Select all or one user" to "Student 1"
  133. Then the following should exist in the "user-grade" table:
  134. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  135. | Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
  136. | Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
  137. | Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
  138. | Test assignment four (extra) | 4.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.00 % |
  139. | Test assignment five (extra) | 2.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.60 % |
  140. | Course total | - | 278.60 | 0350 | 79.60 % | - |
  141. # Contributions of extra credit "four" should be 20/350=5.71% and "five" 10/350=2.86% (350 is max grade for the course, 20 and 10 are max grades of "four" and "five")
  142. And I log out
  143. @javascript
  144. Scenario: Weights are overridden and student has some grades present (before the fix 20150619)
  145. When I set the field "Override weight of Test assignment one" to "1"
  146. And I set the field "Weight of Test assignment one" to "50"
  147. And I press "Save changes"
  148. When I navigate to "View > Grader report" in the course gradebook
  149. And I turn editing mode on
  150. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  151. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  152. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  153. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  154. And I press "Save changes"
  155. And I navigate to "View > User report" in the course gradebook
  156. And I set the field "Select all or one user" to "Student 1"
  157. Then the following should exist in the "user-grade" table:
  158. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  159. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  160. | Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
  161. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  162. | Test assignment four (extra) | 6.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 3.33 % |
  163. | Test assignment five (extra) | 3.33 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.67 % |
  164. | Course total | - | 124.00 | 0150 | 82.67 % | - |
  165. # Contributions of extra credit "four" should be 20/150=13.33% and "five" 10/150=6.67% (150 is max grade for the course, 20 and 10 are max grades of "four" and "five")
  166. And I log out
  167. @javascript
  168. Scenario: Weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
  169. When I set the field "Override weight of Test assignment one" to "1"
  170. And I set the field "Weight of Test assignment one" to "50"
  171. And I press "Save changes"
  172. When I navigate to "View > Grader report" in the course gradebook
  173. And I turn editing mode on
  174. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  175. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  176. And I press "Save changes"
  177. And I navigate to "View > User report" in the course gradebook
  178. And I set the field "Select all or one user" to "Student 1"
  179. Then the following should exist in the "user-grade" table:
  180. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  181. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  182. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  183. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  184. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  185. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  186. | Course total | - | 0.00 | 00 | | - |
  187. And I log out
  188. @javascript
  189. Scenario: Weights are overridden, including extra credit, and student has all grades present (before the fix 20150619)
  190. When I set the field "Override weight of Test assignment one" to "1"
  191. And I set the field "Weight of Test assignment one" to "50"
  192. And I set the field "Override weight of Test assignment four (extra)" to "1"
  193. And I set the field "Weight of Test assignment four (extra)" to "10"
  194. And I press "Save changes"
  195. When I navigate to "View > Grader report" in the course gradebook
  196. And I turn editing mode on
  197. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  198. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  199. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  200. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  201. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  202. And I press "Save changes"
  203. And I navigate to "View > User report" in the course gradebook
  204. And I set the field "Select all or one user" to "Student 1"
  205. Then the following should exist in the "user-grade" table:
  206. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  207. | Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
  208. | Test assignment two | 8.70 % | 30.00 | 050 | 60.00 % | 5.22 % |
  209. | Test assignment three | 34.78 % | 150.00 | 0200 | 75.00 % | 26.09 % |
  210. | Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 5.00 % |
  211. | Test assignment five (extra) | 1.74 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.39 % |
  212. | Course total | - | 271.93 | 0350 | 77.70 % | - |
  213. # Which is absolutely terrible because weights of normal items do not add up to 100%
  214. And I log out
  215. @javascript
  216. Scenario: Weights are overridden, including extra credit, and student has some grades present (before the fix 20150619)
  217. When I set the field "Override weight of Test assignment one" to "1"
  218. And I set the field "Weight of Test assignment one" to "50"
  219. And I set the field "Override weight of Test assignment four (extra)" to "1"
  220. And I set the field "Weight of Test assignment four (extra)" to "10"
  221. And I press "Save changes"
  222. And I navigate to "View > Grader report" in the course gradebook
  223. And I turn editing mode on
  224. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  225. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  226. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  227. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  228. And I press "Save changes"
  229. And I navigate to "View > User report" in the course gradebook
  230. And I set the field "Select all or one user" to "Student 1"
  231. Then the following should exist in the "user-grade" table:
  232. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  233. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  234. | Test assignment two | 0.00 % | 30.00 | 050 | 60.00 % | 0.00 % |
  235. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  236. | Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 8.33 % |
  237. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  238. | Course total | - | 112.50 | 0150 | 75.00 % | - |
  239. # This is just ridiculous, the grades for "two" and "five" are 0 without any reason, and sum weight of normal items is not 100% again.
  240. And I log out
  241. @javascript
  242. Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit (before the fix 20150619)
  243. When I set the field "Override weight of Test assignment one" to "1"
  244. And I set the field "Weight of Test assignment one" to "50"
  245. And I set the field "Override weight of Test assignment four (extra)" to "1"
  246. And I set the field "Weight of Test assignment four (extra)" to "10"
  247. And I press "Save changes"
  248. When I navigate to "View > Grader report" in the course gradebook
  249. And I turn editing mode on
  250. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  251. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  252. And I press "Save changes"
  253. And I navigate to "View > User report" in the course gradebook
  254. And I set the field "Select all or one user" to "Student 1"
  255. Then the following should exist in the "user-grade" table:
  256. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  257. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  258. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  259. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  260. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  261. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  262. | Course total | - | 0.00 | 00 | | - |
  263. And I log out