Skip to content

Commit

Permalink
fix(web): WHODAS calculator - Add parenthesis to max score calculation (
Browse files Browse the repository at this point in the history
#17142)

* Add parenthesis to equation

* Remove console.log

* Hide breakdown for bracket 1

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
RunarVestmann and kodiakhq[bot] authored Dec 5, 2024
1 parent 2804be7 commit 4281d75
Showing 1 changed file with 37 additions and 30 deletions.
67 changes: 37 additions & 30 deletions apps/web/components/connected/WHODAS/Calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,36 +191,42 @@ const WHODASResults = ({
</MarkdownText>
</Stack>

<Stack space={3}>
<Text variant="h3" as="h3">
{formatMessage(m.results.breakdownHeading)}
</Text>
<BulletList>
{results.steps.map((step) => (
<Bullet key={step.title}>
<Box className={styles.breakdownRowContainer}>
<Text>{step.title}</Text>
<Text>{formatScore(step.scoreForStep)}</Text>
{bracket > 1 && (
<Stack space={6}>
<Stack space={3}>
<Stack space={3}>
<Text variant="h3" as="h3">
{formatMessage(m.results.breakdownHeading)}
</Text>
<BulletList>
{results.steps.map((step) => (
<Bullet key={step.title}>
<Box className={styles.breakdownRowContainer}>
<Text>{step.title}</Text>
<Text>{formatScore(step.scoreForStep)}</Text>
</Box>
</Bullet>
))}
</BulletList>
<Box className={styles.totalScoreRowContainer}>
<Text fontWeight="semiBold">
{formatMessage(m.results.totalScore)}
</Text>
<Text fontWeight="semiBold">{formatScore(totalScore)}</Text>
</Box>
</Bullet>
))}
</BulletList>
<Box className={styles.totalScoreRowContainer}>
<Text fontWeight="semiBold">
{formatMessage(m.results.totalScore)}
</Text>
<Text fontWeight="semiBold">{formatScore(totalScore)}</Text>
</Box>
</Stack>
</Stack>
</Stack>
<Box
background="blue100"
paddingX={[4]}
paddingY={[3]}
borderRadius="large"
>
<Text>{formatMessage(m.results.resultDisclaimer)}</Text>
</Box>
</Stack>
)}
</Stack>
<Box
background="blue100"
paddingX={[4]}
paddingY={[3]}
borderRadius="large"
>
<Text>{formatMessage(m.results.resultDisclaimer)}</Text>
</Box>
</Stack>
)
}
Expand All @@ -246,9 +252,10 @@ export const WHODASCalculator = ({ slice }: WHODASCalculatorProps) => {
description,
maxScorePossible: questions.reduce(
(prev, acc) =>
prev + acc.answerOptions.length > 0
prev +
(acc.answerOptions.length > 0
? acc.answerOptions[acc.answerOptions.length - 1].score
: 0,
: 0),
0,
),
questions: questions.map(() => ({
Expand Down

0 comments on commit 4281d75

Please sign in to comment.