/grade/tests/behat/grade_natural_exclude_empty.feature

https://github.com/vadimonus/moodle · Gherkin Specification · 270 lines · 259 code · 11 blank · 0 comment · 6 complexity · f78ecdd36393d1ba51881c03cd094beb MD5 · raw file

  1. @core @core_grades
  2. Feature: Weights in natural aggregation are adjusted if the items are excluded from user report
  3. In order to correctly display user report
  4. As a teacher
  5. I need to be able to exclude hidden grades.
  6. Background:
  7. Given the following "courses" exist:
  8. | fullname | shortname | category | groupmode |
  9. | Course 1 | C1 | 0 | 1 |
  10. And the following "users" exist:
  11. | username | firstname | lastname | email | idnumber |
  12. | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
  13. | student1 | Student | 1 | student1@example.com | s1 |
  14. And the following "course enrolments" exist:
  15. | user | course | role |
  16. | teacher1 | C1 | editingteacher |
  17. | student1 | C1 | student |
  18. And the following "activities" exist:
  19. | activity | course | idnumber | name | intro | grade |
  20. | assign | C1 | a1 | Test assignment one | x | 100 |
  21. | assign | C1 | a2 | Test assignment two | x | 50 |
  22. | assign | C1 | a3 | Test assignment three | x | 200 |
  23. | assign | C1 | a4 | Test assignment four (extra) | x | 20 |
  24. | assign | C1 | a5 | Test assignment five (extra) | x | 10 |
  25. And I log in as "teacher1"
  26. And I follow "Course 1"
  27. And I navigate to "Grades" node in "Course administration"
  28. And I set the field "Grade report" to "Gradebook setup"
  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
  35. When I navigate to "Grades" node in "Course administration"
  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 set the field "Grade report" to "User report"
  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
  56. When I navigate to "Grades" node in "Course administration"
  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 set the field "Grade report" to "User report"
  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
  76. When I navigate to "Grades" node in "Course administration"
  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 set the field "Grade report" to "User report"
  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
  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 "Grades" node in "Course administration"
  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 set the field "Grade report" to "User report"
  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
  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 "Grades" node in "Course administration"
  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 set the field "Grade report" to "User report"
  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) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
  139. | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
  140. | Course total | - | 284.00 | 0350 | 81.14 % | - |
  141. And I log out
  142. @javascript
  143. Scenario: Weights are overridden and student has some grades present
  144. When I set the field "Override weight of Test assignment one" to "1"
  145. And I set the field "Weight of Test assignment one" to "50"
  146. And I press "Save changes"
  147. When I navigate to "Grades" node in "Course administration"
  148. And I turn editing mode on
  149. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  150. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  151. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  152. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  153. And I press "Save changes"
  154. And I set the field "Grade report" to "User report"
  155. And I set the field "Select all or one user" to "Student 1"
  156. Then the following should exist in the "user-grade" table:
  157. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  158. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  159. | Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
  160. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  161. | Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
  162. | Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
  163. | Course total | - | 133.00 | 0150 | 88.67 % | - |
  164. And I log out
  165. @javascript
  166. Scenario: Weights are overridden, student has none grades present except for extra credit
  167. When I set the field "Override weight of Test assignment one" to "1"
  168. And I set the field "Weight of Test assignment one" to "50"
  169. And I press "Save changes"
  170. When I navigate to "Grades" node in "Course administration"
  171. And I turn editing mode on
  172. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  173. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  174. And I press "Save changes"
  175. And I set the field "Grade report" to "User report"
  176. And I set the field "Select all or one user" to "Student 1"
  177. Then the following should exist in the "user-grade" table:
  178. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  179. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  180. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  181. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  182. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  183. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  184. | Course total | - | 0.00 | 00 | | - |
  185. And I log out
  186. @javascript
  187. Scenario: Weights are overridden, including extra credit, and student has all grades present
  188. When I set the field "Override weight of Test assignment one" to "1"
  189. And I set the field "Weight of Test assignment one" to "50"
  190. And I set the field "Override weight of Test assignment four (extra)" to "1"
  191. And I set the field "Weight of Test assignment four (extra)" to "10"
  192. And I press "Save changes"
  193. When I navigate to "Grades" node in "Course administration"
  194. And I turn editing mode on
  195. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  196. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  197. And I give the grade "150.00" to the user "Student 1" for the grade item "Test assignment three"
  198. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  199. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  200. And I press "Save changes"
  201. And I set the field "Grade report" to "User report"
  202. And I set the field "Select all or one user" to "Student 1"
  203. Then the following should exist in the "user-grade" table:
  204. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  205. | Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
  206. | Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
  207. | Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
  208. | Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 5.00 % |
  209. | Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
  210. | Course total | - | 291.50 | 0350 | 83.29 % | - |
  211. And I log out
  212. @javascript
  213. Scenario: Weights are overridden, including extra credit, and student has some grades present
  214. When I set the field "Override weight of Test assignment one" to "1"
  215. And I set the field "Weight of Test assignment one" to "50"
  216. And I set the field "Override weight of Test assignment four (extra)" to "1"
  217. And I set the field "Weight of Test assignment four (extra)" to "10"
  218. And I press "Save changes"
  219. When I navigate to "Grades" node in "Course administration"
  220. And I turn editing mode on
  221. And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
  222. And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
  223. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  224. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  225. And I press "Save changes"
  226. And I set the field "Grade report" to "User report"
  227. And I set the field "Select all or one user" to "Student 1"
  228. Then the following should exist in the "user-grade" table:
  229. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  230. | Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
  231. | Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
  232. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  233. | Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 8.33 % |
  234. | Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
  235. | Course total | - | 135.50 | 0150 | 90.33 % | - |
  236. And I log out
  237. @javascript
  238. Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit
  239. When I set the field "Override weight of Test assignment one" to "1"
  240. And I set the field "Weight of Test assignment one" to "50"
  241. And I set the field "Override weight of Test assignment four (extra)" to "1"
  242. And I set the field "Weight of Test assignment four (extra)" to "10"
  243. And I press "Save changes"
  244. When I navigate to "Grades" node in "Course administration"
  245. And I turn editing mode on
  246. And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
  247. And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
  248. And I press "Save changes"
  249. And I set the field "Grade report" to "User report"
  250. And I set the field "Select all or one user" to "Student 1"
  251. Then the following should exist in the "user-grade" table:
  252. | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
  253. | Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
  254. | Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
  255. | Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
  256. | Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
  257. | Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
  258. | Course total | - | 0.00 | 00 | | - |
  259. And I log out