Skip to content

Commit

Permalink
Add organisation risk to the risk table
Browse files Browse the repository at this point in the history
  • Loading branch information
erikao1998 committed Jan 18, 2024
1 parent 440e61c commit 4ecedc4
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/client/components/ResultPage/RenderAnswers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ const RenderAnswers = ({
...Object.assign({}, ...multiChoiceAnswers),
}

console.log(resultData)

return (
<>
<Typography
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/ResultPage/RiskElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styles from '../../styles'
const { resultStyles, riskColors } = styles

export interface RiskElementProps {
infoText?: string | null
infoText?: string | null | undefined
resultText: string
risk: number | null
style?: any
Expand Down
24 changes: 24 additions & 0 deletions src/client/components/ResultPage/TotalRisk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ const TotalRisk = ({
.find((question) => question.id === 23)
?.optionData.options.find((o) => o.id === resultData[23])?.risk

const organisationRisk = () => {
if (resultData.selectOrganisation) return 1
if (
!resultData.selectOrganisation &&
resultData[24] === 'succefultCollaboration'
)
return 2
if (
!resultData.selectOrganisation &&
resultData[24] === 'noSuccessfulCollaboration'
)
return 3
return null
}

const riskArray = [
{
id: 'country',
Expand Down Expand Up @@ -93,6 +108,14 @@ const TotalRisk = ({
text: t('risks:dualUseRiskLevel'),
riskLevel: dualUseRisk,
},
{
id: 'organisation',
text: 'Organisaation riskitaso',
riskLevel: organisationRisk(),
infoText: results.find(
(r) => r.optionLabel === `organisationRiskLevel${organisationRisk()}`
)?.isSelected[language as keyof Locales],
},
].filter((value) => possibleRiskLevels.includes(value.riskLevel))

if (riskArray.length === 0) return null
Expand Down Expand Up @@ -154,6 +177,7 @@ const TotalRisk = ({
key={risk.id}
resultText={risk.text}
risk={risk.riskLevel}
infoText={risk.infoText}
/>
)
)}
Expand Down
51 changes: 51 additions & 0 deletions src/server/data/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,57 @@ const getResultData = (): Result[] => [
},
},
},
{
id: 22,
surveyId: 1,
optionLabel: 'organisationRiskLevel1',
isSelected: {
fi: '*Yhteistyökumppani löytyy EU:n komission rahoittamiskelpoisten organisaatioiden listalta, joten sitä voidaan pitää luotettavana.*',
sv: '',
en: "*Partner organisation appeard on the EU Commission's list ot eligible organisations, and may be trusted.*",
},
data: {
allDimensions: {
fi: '',
sv: '',
en: '',
},
},
},
{
id: 23,
surveyId: 1,
optionLabel: 'organisationRiskLevel2',
isSelected: {
fi: '*Yhteistyökumppani ei kuulu EUn komission tunnistamiin kumppaniorganisaatioihin, mutta sen kanssa on tehty aiempaa yhteistyötä. Jos luotat edelleen yhteistyökumppaniin, voit edetä yhteistyön suunnittelussa ja toteutuksessa.*',
sv: '',
en: '*Partner organisation does not appear on EU Comission list of approved organisations, but there is a history of previous collaboration. If you continue to trust the partner organisation, you can go ahead and continue planinning and implementing the collaboration.*',
},
data: {
allDimensions: {
fi: '',
sv: '',
en: '',
},
},
},
{
id: 24,
surveyId: 1,
optionLabel: 'organisationRiskLevel3',
isSelected: {
fi: '*Yhteistyökumppani ei kuulu EUn komission tunnistamiin kumppaniorganisaatioihin, eikä sen kanssa ole tehty aiempaa yhteistyötä. Selvitä kumppanin taustat ennen yhteistyöhön sitoutmista ja sen aloittamista.*',
sv: '',
en: "*Partner organisation does not appear on EU Comission list of approved organisations, and there is no history of previous collaboration. Please investigate the partner's background before committing to collaboration.*",
},
data: {
allDimensions: {
fi: '',
sv: '',
en: '',
},
},
},
]

export default getResultData

0 comments on commit 4ecedc4

Please sign in to comment.