Skip to content

Commit

Permalink
MDL-47349 gradereport: Use category title on report
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 30, 2014
1 parent d9033c0 commit 41e62a9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion grade/edit/tree/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function build_html_tree($element, $totals, $parents, $level, &$row_count

$object = $element['object'];
$eid = $element['eid'];
$object->name = $this->gtree->get_element_header($element, true, true, true, true);
$object->name = $this->gtree->get_element_header($element, true, true, true, true, true);
$object->stripped_name = $this->gtree->get_element_header($element, false, false, false);

$is_category_item = false;
Expand Down
7 changes: 5 additions & 2 deletions grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1334,17 +1334,20 @@ public function get_element_icon(&$element, $spacerifnone=false) {
* @param bool $icon Whether or not to display an icon with this header
* @param bool $spacerifnone return spacer if no icon found
* @param bool $withdescription Show description if defined by this item.
* @param bool $fulltotal If the item is a category total, returns $categoryname."total"
* instead of "Category total" or "Course total"
*
* @return string header
*/
public function get_element_header(&$element, $withlink=false, $icon=true, $spacerifnone=false, $withdescription=false) {
public function get_element_header(&$element, $withlink = false, $icon = true, $spacerifnone = false,
$withdescription = false, $fulltotal = false) {
$header = '';

if ($icon) {
$header .= $this->get_element_icon($element, $spacerifnone);
}

$header .= $element['object']->get_name();
$header .= $element['object']->get_name($fulltotal);

if ($element['type'] != 'item' and $element['type'] != 'categoryitem' and
$element['type'] != 'courseitem') {
Expand Down
2 changes: 1 addition & 1 deletion grade/report/grader/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public function get_right_rows($displayaverages) {
$arrow = $this->get_sort_arrow('move', $sortlink);
}

$headerlink = $this->gtree->get_element_header($element, true, $showactivityicons, false);
$headerlink = $this->gtree->get_element_header($element, true, $showactivityicons, false, false, true);

$itemcell = new html_table_cell();
$itemcell->attributes['class'] = $type . ' ' . $catlevel . ' highlightable'. ' i'. $element['object']->id;
Expand Down
2 changes: 1 addition & 1 deletion grade/report/singleview/classes/local/screen/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function format_line($item) {
$gradetreeitem['object'] = $item;
$gradetreeitem['userid'] = $this->item->id;

$itemlabel = $this->structure->get_element_header($gradetreeitem, true, false);
$itemlabel = $this->structure->get_element_header($gradetreeitem, true, false, false, false, true);
$grade->label = $item->get_name();

$line = array(
Expand Down
2 changes: 1 addition & 1 deletion grade/report/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private function fill_table_recursive(&$element) {
$grade_object = $element['object'];
$eid = $grade_object->id;
$element['userid'] = $this->user->id;
$fullname = $this->gtree->get_element_header($element, true, true, true, true);
$fullname = $this->gtree->get_element_header($element, true, true, true, true, true);
$data = array();
$hidden = '';
$excluded = '';
Expand Down
4 changes: 2 additions & 2 deletions grade/tests/behat/grade_calculated_weights.feature
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Feature: We can understand the gradebook user report
| 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 | - |
| Sub category totalWeighted mean of grades. | 33.33 % | 36.67 | - |
| Course total | - | 156.67 | - |

@javascript
Expand All @@ -244,5 +244,5 @@ Feature: We can understand the gradebook user report
| 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 | - |
| Sub category total | 60.00 % | 110.00 | - |
| Course total | - | 230.00 | - |
12 changes: 6 additions & 6 deletions grade/tests/behat/grade_scales.feature
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ Feature: View gradebook when scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | C | FA | 50.00 % | 60.00 % |
| Category total | 3.00 | 05 | 60.00 % | - |
| Sub category 1 total | 3.00 | 05 | 60.00 % | - |
| Course total | 3.00 | 05 | 60.00 % | - |
And I set the field "jump" to "Categories and items"
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | 5.00 |
| Category total | 5.00 |
| Sub category 1 total | 5.00 |
| Course total | 5.00 |
And I log out
And I log in as "student2"
Expand All @@ -105,7 +105,7 @@ Feature: View gradebook when scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | B | FA | 75.00 % | 80.00 % |
| Category total | 4.00 | 05 | 80.00 % | - |
| Sub category 1 total | 4.00 | 05 | 80.00 % | - |
| Course total | 4.00 | 05 | 80.00 % | - |

@javascript
Expand Down Expand Up @@ -138,13 +138,13 @@ Feature: View gradebook when scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | C | FA | 50.00 % | <contrib3> |
| Category total<aggregation>. | 3.00 | 15 | 50.00 % | - |
| Sub category (<aggregation>) total<aggregation>. | 3.00 | 15 | 50.00 % | - |
| Course total<aggregation>. | <coursetotal3> | 0100 | <courseperc3> | - |
And I set the field "jump" to "Categories and items"
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | A (5) |
| Category total<aggregation>. | |
| Sub category (<aggregation>) total<aggregation>. | |
| Course total<aggregation>. | |
And I log out
And I log in as "student2"
Expand All @@ -153,7 +153,7 @@ Feature: View gradebook when scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | B | FA | 75.00 % | <contrib2> |
| Category total<aggregation>. | 4.00 | 15 | 75.00 % | - |
| Sub category (<aggregation>) total<aggregation>. | 4.00 | 15 | 75.00 % | - |
| Course total<aggregation>. | <coursetotal2> | 0100 | <courseperc2> | - |

Examples:
Expand Down
10 changes: 5 additions & 5 deletions grade/tests/behat/grade_single_item_scales.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ Feature: View gradebook when single item scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!–Ace! | 100.00 % |
| Category total | 1.00 | 01 | - |
| Sub category 1 total | 1.00 | 01 | - |
| Course total | 1.00 | 01 | - |
And I set the field "Select all or one user" to "Student 2"
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | - | Ace!–Ace! | - |
| Category total | - | 01 | - |
| Sub category 1 total | - | 01 | - |
| Course total | - | 01 | - |
And I set the field "jump" to "Categories and items"
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | 1.00 |
| Category total | 1.00 |
| Sub category 1 total | 1.00 |
| Course total | 1.00 |

@javascript
Expand Down Expand Up @@ -113,13 +113,13 @@ Feature: View gradebook when single item scales are used
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!–Ace! | <contrib1> |
| Category total<aggregation>. | <cattotal1> | 0100 | - |
| Sub category (<aggregation>) total<aggregation>. | <cattotal1> | 0100 | - |
| Course total<aggregation>. | <coursetotal1> | 0100 | - |
And I set the field "jump" to "Categories and items"
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | Ace! (1) |
| Category total<aggregation>. | 100.00 |
| Sub category (<aggregation>) total<aggregation>. | 100.00 |
| Course total<aggregation>. | 100.00 |

Examples:
Expand Down

0 comments on commit 41e62a9

Please sign in to comment.