Skip to content

Commit

Permalink
Account for half point only votes in results
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenWeathers committed Jun 17, 2023
1 parent eb08461 commit 651f6f9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions frontend/src/components/battle/VoteResults.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@
: 0
const preAverage = sum / votesToAverage.length || 0
switch (averageRounding) {
case 'round':
average = Math.round(preAverage)
break
case 'floor':
average = Math.floor(preAverage)
break
default:
average = Math.ceil(preAverage)
if (preAverage !== 0.5) {
switch (averageRounding) {
case 'round':
average = Math.round(preAverage)
break
case 'floor':
average = Math.floor(preAverage)
break
default:
average = Math.ceil(preAverage)
}
} else {
average = preAverage
}
}
Expand Down

0 comments on commit 651f6f9

Please sign in to comment.