Skip to content

Commit

Permalink
feature: improve display and counting of floats
Browse files Browse the repository at this point in the history
  • Loading branch information
scammo committed Sep 13, 2023
1 parent c4a566b commit 159d837
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/structs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const fromProposal = (raw) => ({
...raw,
label: `${raw.id} - ${raw.thesis_name}`,
vote_average: raw.opinions.reduce(
(accumulator, currentValue) => accumulator + currentValue.vote,
(accumulator, currentValue) => (parseFloat(accumulator) + parseFloat(currentValue.vote)).toFixed(2),
0
),
comments_count: raw.opinions.filter(
Expand Down
2 changes: 1 addition & 1 deletion src/views/orga/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const loadPoposals = async () => {
"DD.MM.YYYY HH:MM"
);
const vote_average = proposal.opinions.reduce(
(accumulator, currentValue) => accumulator + currentValue.vote,
(accumulator, currentValue) => (parseFloat(accumulator) + parseFloat(currentValue.vote)).toFixed(2),
0
);
const comments_count = proposal.opinions.filter(
Expand Down
8 changes: 4 additions & 4 deletions src/views/orga/Proposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ onMounted(async () => {
<div class="col">
<div class="flex mt-1">
<Card class="mr-1" style="max-width: 60px; max-height: 120px">
<template #title>🗳️ {{ proposal.vote_average }} </template>
<template #content>🗳️ {{ proposal.vote_average }} </template>
</Card>
<Card class="mr-1" style="max-width: 60px; max-height: 120px">
<template #title>👥 {{ proposal.vote_count }} </template>
<template #content>👥 {{ proposal.vote_count }} </template>
</Card>
<Card class="mr-1" style="max-width: 60px; max-height: 120px">
<template #title>📝 {{ proposal.comments_count }} </template>
<template #content>📝 {{ proposal.comments_count }} </template>
</Card>
<Card style="max-width: 240px; max-height: 120px">
<template #title>Status: {{ status[proposal.status]?.name || proposal.status }}
<template #content>Status: {{ status[proposal.status]?.name || proposal.status }}
</template>
</Card>
</div>
Expand Down

0 comments on commit 159d837

Please sign in to comment.