Skip to content

Commit

Permalink
fix display of teams and student without teams in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
irinahpe committed Oct 1, 2024
1 parent fa73140 commit 9ce7214
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classes/allocations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct($ratingallocate) {
$this->is_downloading($download, $ratingallocate->ratingallocate->name . '-allocations', 'allocations');
}
// If teamvote is enabled, show allocation of teams.
$this->showteams = (bool) $this->ratingallocate->get_teamvote_groups();
$this->showteams = (bool) $this->ratingallocate->get_teamvote_groupingid();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions classes/ratings_and_allocations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ public function __construct(\mod_ratingallocate_renderer $renderer, $titles, $ra
$this->shownames = true;
// We only show the group column if at least one group is being used in at least one active restriction setting of a choice.
$this->showgroups = !empty($allgroupsofchoices);
$teamvote = $this->ratingallocate->get_teamvote_groups();
$this->ratingallocate->delete_groups_for_usersnogroup($teamvote);
$this->showteams = (bool) $teamvote;
$this->showteams = (bool) $this->ratingallocate->get_teamvote_groupingid();

}

Expand Down
6 changes: 5 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,9 @@ public function get_ratings_for_rateable_choices_with_teamvote() {
}

/**
* Returns the groups in the teamvote grouping with the amount of groupmembers
* Returns the groups in the teamvote grouping with the amount of groupmembers.
* Since this function creates unnecessary groups, only use in advance of running the endmonds karp algorithm.
* In order to check wether teamvote is enabled, please use get_teamvote_groupingid().
*
* @return array|false Array of the form groupid => membercount if teamvote is enabled, false if not
* @throws dml_exception
Expand All @@ -1337,6 +1339,7 @@ public function get_teamvote_groups() {
}
}

// This is a little ugly, but the only way the algortihm can run including teams.
$groupdata = new stdClass();
$groupdata->courseid = $this->course->id;
$groupdata->idnumber = $this->ratingallocateid;
Expand Down Expand Up @@ -1385,6 +1388,7 @@ public function get_preventvotenotingroup() {

/**
* Return the teamvote groupingid if teamvote is enabled, false if not.
* Use this method to check wether teamvote is enabled.
*
* @return false|mixed false or the groupingid
* @throws dml_exception
Expand Down

0 comments on commit 9ce7214

Please sign in to comment.