Skip to content

Commit

Permalink
Merge branch 'MDL-47713-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski authored and stronk7 committed Oct 24, 2014
2 parents e739fbc + b0c5a9c commit 7a811fb
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 128 deletions.
7 changes: 4 additions & 3 deletions grade/report/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,9 @@ public function fill_contributions_column($element) {
$parent = false;
}
} while ($parent);
// Finally multiply by the course grademax.
$gradeval *= $this->aggregationhints[$itemid]['grademax'];

// Convert to percent.
$gradeval *= 100;

// Now we need to loop through the "built" table data and update the
// contributions column for the current row.
Expand All @@ -761,7 +762,7 @@ public function fill_contributions_column($element) {
if (isset($row['itemname']) && ($row['itemname']['id'] == $header_row)) {
// Found it - update the column.
$decimals = $grade_object->get_decimals();
$this->tabledata[$key]['contributiontocoursetotal']['content'] = format_float($gradeval, $decimals, true);
$this->tabledata[$key]['contributiontocoursetotal']['content'] = format_float($gradeval, $decimals, true) . ' %';
break;
}
}
Expand Down
66 changes: 33 additions & 33 deletions grade/tests/behat/grade_aggregation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ Feature: We can use calculated grade totals
And I set the field "Select all or one user" to "Student 1"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Contribution to course total |
| Test assignment five | 28.57 % | 10.00 (50.00 %) | 020 | 6.43 |
| Test assignment six | 50.00 % | 5.00 (50.00 %) | 010 | 11.25 |
| Test assignment seven | 21.43 % | - | 015 | 0.00 |
| Test assignment eight | 66.67 % | 10.00 (50.00 %) | 020 | 10.00 |
| Test assignment nine | 33.33 % | 5.00 (50.00 %) | 010 | 5.00 |
| Test assignment ten | -( Empty ) | - | 015 | 0.00 |
| Test assignment one | 48.00 % | 60.00 (20.00 %) | 0300 | 60.00 |
| Test assignment two | 16.00 % | 20.00 (20.00 %) | 0100 | 20.00 |
| Test assignment three | 24.00 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 40.00 |
| Test assignment four | 24.00 % | - | 0150 | 0.00 |
| Test assignment five | 28.57 % | 10.00 (50.00 %) | 020 | 1.03 % |
| Test assignment six | 50.00 % | 5.00 (50.00 %) | 010 | 1.80 % |
| Test assignment seven | 21.43 % | - | 015 | 0.00 % |
| Test assignment eight | 66.67 % | 10.00 (50.00 %) | 020 | 1.60 % |
| Test assignment nine | 33.33 % | 5.00 (50.00 %) | 010 | 0.80 % |
| Test assignment ten | -( Empty ) | - | 015 | 0.00 % |
| Test assignment one | 48.00 % | 60.00 (20.00 %) | 0300 | 9.60 % |
| Test assignment two | 16.00 % | 20.00 (20.00 %) | 0100 | 3.20 % |
| Test assignment three | 24.00 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 6.40 % |
| Test assignment four | 24.00 % | - | 0150 | 0.00 % |
And I log out
And I log in as "student1"
And I follow "Course 1"
Expand All @@ -413,13 +413,13 @@ Feature: We can use calculated grade totals
And I set the field "Grade report" to "User report"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Contribution to course total |
| Test assignment six | 70.00 % | 5.00 (50.00 %) | 010 | 8.75 |
| Test assignment seven | 30.00 % | - | 015 | 0.00 |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 010 | 5.00 |
| Test assignment ten | -( Empty ) | - | 015 | 0.00 |
| Test assignment one | 61.86 % | 60.00 (20.00 %) | 0300 | 60.0 |
| Test assignment three | 30.93 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 40.0 |
| Test assignment four | 30.93 % | - | 0150 | 0.00 |
| Test assignment six | 70.00 % | 5.00 (50.00 %) | 010 | 1.80 % |
| Test assignment seven | 30.00 % | - | 015 | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 010 | 1.03 % |
| Test assignment ten | -( Empty ) | - | 015 | 0.00 % |
| Test assignment one | 61.86 % | 60.00 (20.00 %) | 0300 | 12.37 % |
| Test assignment three | 30.93 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 8.25 % |
| Test assignment four | 30.93 % | - | 0150 | 0.00 % |

@javascript
Scenario: Natural aggregation with drop lowest
Expand Down Expand Up @@ -587,15 +587,15 @@ Feature: We can use calculated grade totals
And I set the field "Select all or one user" to "Student 1"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment five | 57.14 % | 10.00 (50.00 %) | 10.00 |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 |
| Test assignment seven | 42.86 % | - | 0.00 |
| Test assignment eight | 0.00 % | 10.00 (50.00 %) | 0.00 |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 5.00 |
| Test assignment ten | 0.00 % | - | 0.00 |
| Test assignment one | 0.00 % | 60.00 (20.00 %) | 0.00 |
| Test assignment two | 22.47 % | 20.00 (20.00 %) | 20.00 |
| Test assignment three | 33.71 % | 40.00 (26.67 %) | 40.00 |
| Test assignment five | 57.14 % | 10.00 (50.00 %) | 2.25 % |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 % |
| Test assignment seven | 42.86 % | - | 0.00 % |
| Test assignment eight | 0.00 % | 10.00 (50.00 %) | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 1.12 % |
| Test assignment ten | 0.00 % | - | 0.00 % |
| Test assignment one | 0.00 % | 60.00 (20.00 %) | 0.00 % |
| Test assignment two | 22.47 % | 20.00 (20.00 %) | 4.49 % |
| Test assignment three | 33.71 % | 40.00 (26.67 %) | 8.99 % |
| Test assignment four | 33.71 % | - | 0.00 |
And I log out
And I log in as "student1"
Expand All @@ -606,10 +606,10 @@ Feature: We can use calculated grade totals
And I set the field "Grade report" to "User report"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 |
| Test assignment seven | 100.00 % | - | 0.00 |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 5.00 |
| Test assignment ten | 0.00 | - | 0.00 |
| Test assignment one | 0.00 % | 60.00 (20.00 %) | 0.00 |
| Test assignment three | 46.15 % | 40.00 (26.67 %) | 40.00 |
| Test assignment four | 46.15 % | - | 0.00 |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 % |
| Test assignment seven | 100.00 % | - | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 1.54 % |
| Test assignment ten | 0.00 | - | 0.00 % |
| Test assignment one | 0.00 % | 60.00 (20.00 %) | 0.00 % |
| Test assignment three | 46.15 % | 40.00 (26.67 %) | 12.31 % |
| Test assignment four | 46.15 % | - | 0.00 % |
120 changes: 60 additions & 60 deletions grade/tests/behat/grade_calculated_weights.feature
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 25.00 % | 60.00 | 15.00 |
| Test assignment two | 25.00 % | 20.00 | 5.00 |
| Test assignment three | 25.00 % | 40.00 | 10.00 |
| Test assignment four | 33.33 % | 10.00 | 0.83 |
| Test assignment five | 33.33 % | 70.00 | 5.83 |
| Test assignment six | 33.33 % | 30.00 | 2.50 |
| Test assignment one | 25.00 % | 60.00 | 15.00 % |
| Test assignment two | 25.00 % | 20.00 | 5.00 % |
| Test assignment three | 25.00 % | 40.00 | 10.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.83 % |
| Test assignment five | 33.33 % | 70.00 | 5.83 % |
| Test assignment six | 33.33 % | 30.00 | 2.50 % |

@javascript
Scenario: Weighted mean of grades aggregation
Expand All @@ -90,12 +90,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 40.00 % | 60.00 | 24.00 |
| Test assignment two | 20.00 % | 20.00 | 4.00 |
| Test assignment three | 20.00 % | 40.00 | 8.00 |
| Test assignment four | 33.33 % | 10.00 | 0.67 |
| Test assignment five | 33.33 % | 70.00 | 4.67 |
| Test assignment six | 33.33 % | 30.00 | 2.00 |
| Test assignment one | 40.00 % | 60.00 | 24.00 % |
| Test assignment two | 20.00 % | 20.00 | 4.00 % |
| Test assignment three | 20.00 % | 40.00 | 8.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.67 % |
| Test assignment five | 33.33 % | 70.00 | 4.67 % |
| Test assignment six | 33.33 % | 30.00 | 2.00 % |

@javascript
Scenario: Simple weighted mean of grades aggregation
Expand All @@ -111,12 +111,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 20.00 |
| Test assignment two | 33.33 % | 20.00 | 6.67 |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 |
| Test assignment four | 33.33 % | 10.00 | 1.11 |
| Test assignment five | 33.33 % | 70.00 | 7.78 |
| Test assignment six | 33.33 % | 30.00 | 3.33 |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |

@javascript
Scenario: Mean of grades (with extra credits) aggregation
Expand All @@ -130,12 +130,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 20.00 |
| Test assignment two | 33.33 % | 20.00 | 6.67 |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 |
| Test assignment four | 33.33 % | 10.00 | 1.11 |
| Test assignment five | 33.33 % | 70.00 | 7.78 |
| Test assignment six | 33.33 % | 30.00 | 3.33 |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |

@javascript
Scenario: Median of grades aggregation
Expand All @@ -147,12 +147,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 0.00 % | 60.00 | 0.00 |
| Test assignment two | 0.00 % | 20.00 | 0.00 |
| Test assignment three | 50.00 % | 40.00 | 20.00 |
| Test assignment four | 33.33 % | 10.00 | 1.67 |
| Test assignment five | 33.33 % | 70.00 | 11.67 |
| Test assignment six | 33.33 % | 30.00 | 5.00 |
| Test assignment one | 0.00 % | 60.00 | 0.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 50.00 % | 40.00 | 20.00 % |
| Test assignment four | 33.33 % | 10.00 | 1.67 % |
| Test assignment five | 33.33 % | 70.00 | 11.67 % |
| Test assignment six | 33.33 % | 30.00 | 5.00 % |

@javascript
Scenario: Lowest grade aggregation
Expand All @@ -164,12 +164,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 0.00 % | 60.00 | 0.00 |
| Test assignment two | 100.00 % | 20.00 | 20.00 |
| Test assignment three | 0.00 % | 40.00 | 0.00 |
| Test assignment four | 33.33 % | 10.00 | 0.00 |
| Test assignment five | 33.33 % | 70.00 | 0.00 |
| Test assignment six | 33.33 % | 30.00 | 0.00 |
| Test assignment one | 0.00 % | 60.00 | 0.00 % |
| Test assignment two | 100.00 % | 20.00 | 20.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |

@javascript
Scenario: Highest grade aggregation
Expand All @@ -181,12 +181,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 100.00 % | 60.00 | 60.00 |
| Test assignment two | 0.00 % | 20.00 | 0.00 |
| Test assignment three | 0.00 % | 40.00 | 0.00 |
| Test assignment four | 33.33 % | 10.00 | 0.00 |
| Test assignment five | 33.33 % | 70.00 | 0.00 |
| Test assignment six | 33.33 % | 30.00 | 0.00 |
| Test assignment one | 100.00 % | 60.00 | 60.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |

@javascript
Scenario: Mode of grades aggregation
Expand All @@ -198,12 +198,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 100.00 % | 60.00 | 60.00 |
| Test assignment two | 0.00 % | 20.00 | 0.00 |
| Test assignment three | 0.00 % | 40.00 | 0.00 |
| Test assignment four | 33.33 % | 10.00 | 0.00 |
| Test assignment five | 33.33 % | 70.00 | 0.00 |
| Test assignment six | 33.33 % | 30.00 | 0.00 |
| Test assignment one | 100.00 % | 60.00 | 60.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |

@javascript
Scenario: View user report with mixed aggregation methods
Expand All @@ -219,12 +219,12 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 60.00 |
| Test assignment two | 33.33 % | 20.00 | 20.00 |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 40.00 |
| Test assignment four | 33.33 % | 10.00 | 3.33 |
| Test assignment five | 33.33 % | 70.00 | 23.33 |
| Test assignment six | 33.33 % | 30.00 | 10.00 |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |
| Category totalWeighted mean of grades. | 33.33 % | 36.67 | - |
| Course total | - | 156.67 | - |

Expand All @@ -238,11 +238,11 @@ Feature: We can understand the gradebook user report
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 20.00 % | 60.00 | 60.00 |
| Test assignment two | 20.00 % | 20.00 | 20.00 |
| Test assignment three | 20.00 %( Extra credit ) | 40.00 | 40.00 |
| Test assignment four | 33.33 % | 10.00 | 10.00 |
| Test assignment five | 33.33 % | 70.00 | 70.00 |
| Test assignment six | 33.33 % | 30.00 | 30.00 |
| Test assignment one | 20.00 % | 60.00 | 12.00 % |
| Test assignment two | 20.00 % | 20.00 | 4.00 % |
| Test assignment three | 20.00 %( Extra credit ) | 40.00 | 8.00 % |
| Test assignment four | 33.33 % | 10.00 | 2.00 % |
| Test assignment five | 33.33 % | 70.00 | 14.00 % |
| Test assignment six | 33.33 % | 30.00 | 6.00 % |
| Category total | 60.00 % | 110.00 | - |
| Course total | - | 230.00 | - |
Loading

0 comments on commit 7a811fb

Please sign in to comment.