Skip to content

Commit

Permalink
Fix bug on diff calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramirisu committed Feb 17, 2024
1 parent a77da48 commit ecda207
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pages/Result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ const Result = () => {
>
<Row>
{getTopScores(getPoliticalPartyMatchScores(weights), expandParty, 3).map((value, index) => {
const diff = Math.round(100 * value.diff)
const link = t(`quiz.result.political_parties.data.${value.id}.link`)
const createLabel = () => (
<>
Expand All @@ -363,17 +364,17 @@ const Result = () => {
>
{t(`quiz.result.political_parties.data.${value.id}.name`)}
</Text>
<DiffFilled style={{ margin: '3px', color: getDiffColor(value.diff) }} />
<DiffFilled style={{ margin: '3px', color: getDiffColor(diff) }} />
<Text
style={{
color: getDiffColor(value.diff),
color: getDiffColor(diff),
fontSize: isLanguage('en')
? `${getSizeWithStep(100, -8, 4, index)}%`
: `${getSizeWithStep(100, -8, 4, index)}%`,
textAlign: 'center',
}}
>
{`${Math.round(value.diff * 100)}%`}
{`${diff}%`}
</Text>
</>
)
Expand Down

0 comments on commit ecda207

Please sign in to comment.