From 66dc0d89b5c6250908afca81b836db9414b1f166 Mon Sep 17 00:00:00 2001 From: scammo Date: Wed, 3 Apr 2024 14:38:56 +0200 Subject: [PATCH] #5 fix correctly sorting cumulitive votes --- frontend/src/views/orga/ProposalsTrack.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/orga/ProposalsTrack.vue b/frontend/src/views/orga/ProposalsTrack.vue index 5753574..99a0697 100644 --- a/frontend/src/views/orga/ProposalsTrack.vue +++ b/frontend/src/views/orga/ProposalsTrack.vue @@ -45,12 +45,12 @@ const loadPoposals = async () => { proposal.created_at = dayjs(proposal.created_at).format( "DD.MM.YYYY HH:mm" ); - const vote_average = proposal.opinions.reduce( + const vote_average = +proposal.opinions.reduce( (accumulator, currentValue) => (parseFloat(accumulator) + parseFloat(currentValue.vote)).toFixed(2), 0 ); const comments_count = proposal.opinions.filter( - (opinion) => !!opinion.comment && opinion.comment !== "" + (opinion) => !!opinion.commvote_averageent && opinion.comment !== "" ).length; const vote_count = proposal.opinions.filter( (opinion) => opinion.vote !== null @@ -180,7 +180,6 @@ const rowClass = (data) => {