From 8dc232c0c79b124d43ad45c0b86147f379c0af48 Mon Sep 17 00:00:00 2001 From: erikao1998 Date: Wed, 24 Jan 2024 13:39:28 +0200 Subject: [PATCH] Remove funder and funding from algorithm and add economic risk level --- .../components/ResultPage/TotalRisk.tsx | 33 +++++-------------- src/client/locales/en.json | 3 +- src/client/locales/fi.json | 3 +- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/client/components/ResultPage/TotalRisk.tsx b/src/client/components/ResultPage/TotalRisk.tsx index 441543d..eca7f6f 100644 --- a/src/client/components/ResultPage/TotalRisk.tsx +++ b/src/client/components/ResultPage/TotalRisk.tsx @@ -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 @@ -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'), @@ -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 diff --git a/src/client/locales/en.json b/src/client/locales/en.json index e061281..226b39b 100644 --- a/src/client/locales/en.json +++ b/src/client/locales/en.json @@ -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**", diff --git a/src/client/locales/fi.json b/src/client/locales/fi.json index 8a8e6d5..63c577a 100644 --- a/src/client/locales/fi.json +++ b/src/client/locales/fi.json @@ -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**",