Skip to content

Commit

Permalink
Remove funder and funding from algorithm and add economic risk level
Browse files Browse the repository at this point in the history
  • Loading branch information
erikao1998 committed Jan 24, 2024
1 parent dccbd01 commit 8dc232c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
33 changes: 9 additions & 24 deletions src/client/components/ResultPage/TotalRisk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,14 @@ const TotalRisk = ({

const possibleRiskLevels = [0, 1, 2, 3, 4, 5]

const fundingRisk = questions
.filter((question) => [14, 15].includes(question.id))
?.map(
(question) =>
question.optionData.options.find(
(o) => o.id === resultData[question.id]
)?.risk
)
.reduce((a, b) => a * b, 1)

const funderRisk = questions
.find((question) => question.id === 13)
?.optionData.options.find((o) => o.id === resultData[13])?.risk

const durationRisk = questions
.find((question) => question.id === 12)
?.optionData.options.find((o) => o.id === resultData[12])?.risk

const economicRisk = questions
.find((question) => question.id === 16)
?.optionData.options.find((o) => o.id === resultData[16])?.risk

const dualUseRisk = () => {
if (euCountries.includes(resultData[8])) return 1
return questions
Expand Down Expand Up @@ -107,16 +97,6 @@ const TotalRisk = ({
text: t('risks:universityRiskLevel'),
riskLevel: universityRisk(resultData['20'], resultData['21']),
},
{
id: 'funder',
text: t('risks:funderRiskLevel'),
riskLevel: funderRisk,
},
{
id: 'funding',
text: t('risks:fundingRiskLevel'),
riskLevel: fundingRisk,
},
{
id: 'duration',
text: t('risks:durationRiskLevel'),
Expand All @@ -138,6 +118,11 @@ const TotalRisk = ({
(r) => r.optionLabel === `organisationRiskLevel${organisationRisk()}`
)?.isSelected[language as keyof Locales],
},
{
id: 'economic',
text: t('risks:economicRiskLevel'),
riskLevel: economicRisk,
},
].filter((value) => possibleRiskLevels.includes(value.riskLevel))

if (riskArray.length === 0) return null
Expand Down
3 changes: 1 addition & 2 deletions src/client/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"countryRiskLevel": "Risk level of the partner country",
"universityRiskLevel": "Risk level of the partner university",
"durationRiskLevel": "Risk level of the project duration",
"funderRiskLevel": "Risk level of the project funder",
"fundingRiskLevel": "Risk level of the external funding",
"economicRiskLevel": "Economic risk level",
"dualUseRiskLevel": "Risk level of the dual use",
"organisationRiskLevel": "Risk level of the partner organisation",
"totalRiskLevel": "**Total risk level of the project**",
Expand Down
3 changes: 1 addition & 2 deletions src/client/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"countryRiskLevel": "Maan riskitaso",
"universityRiskLevel": "Yliopiston riskitaso",
"durationRiskLevel": "Yhteistyön keston riskitaso",
"funderRiskLevel": "Projektin rahoittajan riskitaso",
"fundingRiskLevel": "Ulkopuolisen rahoituksen riskitaso",
"economicRiskLevel": "Yhteistyön taloudellinen riskitaso",
"dualUseRiskLevel": "Kaksikäyttötuotteiden riskitaso",
"organisationRiskLevel": "Yhteistyöorganisaation riskitaso",
"totalRiskLevel": "**Yhteistyön kokonaisriskitaso**",
Expand Down

0 comments on commit 8dc232c

Please sign in to comment.