Skip to content

Commit

Permalink
Merge pull request #75 from odeialba/SV-73
Browse files Browse the repository at this point in the history
SV-73 Sorting cards not picking up filters
  • Loading branch information
odeialba authored Oct 11, 2024
2 parents 645cd0e + 5f61c68 commit 52e136b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classes/output/sort_voting_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function export_for_template(renderer_base $output): array {
$position = isset($existingvotes[$option->id]) ? $existingvotes[$option->id] : $defaultposition++;
$optionsclean[] = [
'id' => $option->id,
'text' => $option->text,
'text' => format_text($option->text, FORMAT_HTML),
'position' => $position,
];
}
Expand Down
4 changes: 4 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ function sortvoting_get_response_data(stdClass $sortvoting, bool $onlyactive = t
$previousvote = null;
$maxvotescount = empty($existingvotes) ? 0 : (int) max(array_column($existingvotes, 'votescount'));
foreach ($existingvotes as $key => $vote) {
// Format text for the results.
$existingvotes[$key]->text = format_text($vote->text, FORMAT_HTML);

// Get correct positions, using the same for equal votes.
if ($previousvote !== null && $previousvote->avg !== $vote->avg) {
$position++;
}
Expand Down

0 comments on commit 52e136b

Please sign in to comment.