Skip to content

Commit

Permalink
Multiply sanctions risk also in the risk table
Browse files Browse the repository at this point in the history
  • Loading branch information
erikao1998 committed Jan 4, 2024
1 parent a9e6c41 commit 1118854
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/client/components/ResultPage/CountryResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import { useTranslation } from 'react-i18next'

import { Locales, Result } from '@backend/types'

import { CountryData } from '../../types'
import { CountryData, FormValues } from '../../types'
import RiskElement from './RiskElement'

const CountryResults = ({
country,
results,
resultData,
}: {
country: CountryData | undefined
results: Result[]
resultData: FormValues
}) => {
const { t, i18n } = useTranslation()

Expand All @@ -37,6 +39,8 @@ const CountryResults = ({
)?.isSelected[language as keyof Locales]

const sanctionsRisk = country.sanctions ? 2 : 1
const sanctionsMultiplier =
sanctionsRisk === 2 && resultData['11'].research ? 1.5 : 1

return (
<>
Expand Down Expand Up @@ -66,7 +70,7 @@ const CountryResults = ({
/>
<RiskElement
resultText={t('results:sanctions')}
risk={sanctionsRisk}
risk={sanctionsRisk * sanctionsMultiplier}
infoText={sanctionsRisk === 2 ? t('risks:sanctionsRisk') : ''}
style={{ paddingLeft: '30px' }}
/>
Expand Down
6 changes: 5 additions & 1 deletion src/client/components/ResultPage/TotalRisk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ const TotalRisk = ({
infoText={riskArray[0].riskLevel === 1 ? t('risks:noRisk') : ''}
/>
{riskArray[0].riskLevel !== 1 && (
<CountryResults country={country} results={results} />
<CountryResults
country={country}
results={results}
resultData={resultData}
/>
)}
</>
)}
Expand Down

0 comments on commit 1118854

Please sign in to comment.