Skip to content

Commit

Permalink
added form 7 tweaks for report page
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Oct 24, 2024
1 parent 5358227 commit b0db2f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/components/ReportPage/ColorAnswers.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const ColorAnswers = ({ year, allAnswers, questionsList, chosenProgrammes, setAc
chosenProgrammes={chosenProgrammes}
setActiveTab={setActiveTab}
setShowing={setShowing}
form={form}
/>
)}
</div>
Expand Down
25 changes: 25 additions & 0 deletions client/components/ReportPage/PieChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export default ({
withoutEmpty: { value: 0, programmes: [] },
total: { value: 0 },
}
if (form === 7) {
colors.gray = { value: 0, programmes: [] }
}
answers.forEach(a => {
if (!a) return

Expand All @@ -51,6 +54,9 @@ export default ({
}
})
colors.withoutEmpty.value = colors.red.value + colors.green.value + colors.yellow.value
if (form === 7) {
colors.withoutEmpty.value += colors.gray.value
}
colors.total.value = colors.withoutEmpty.value + colors.emptyAnswer.value
return colors
}
Expand Down Expand Up @@ -88,6 +94,15 @@ export default ({
programmes: colorSums.emptyAnswer.programmes,
},
]
if (form === 7) {
data.push({
color: colors.gray,
toolTipColor: 'gray',
toolTipHeader: t('gray'),
value: colorSums.gray.value || 0,
programmes: colorSums.gray.programmes,
})
}
return data.sort((a, b) => b.value - a.value)
}

Expand Down Expand Up @@ -123,6 +138,15 @@ export default ({
form === formKeys.EVALUATION_FACULTIES
? { secondLabel: `overview:uniAnswerLevels:${level}` }
: { secondLabel: faculty }

const colorDistribution = () => {
let distribution = `${t('green')} ${colorSums.green.value} | ${t('yellow')} ${colorSums.yellow.value} | ${t('red')} ${colorSums.red.value}`
if (form === 7) {
distribution += ` | ${t('gray')} ${colorSums.gray.value}`
}
return distribution
}

return (
<div style={{ width: '400px', paddingBottom: '300px' }} key={`${chosenProgrammes}-${answers}-${showEmpty}`}>
<div>
Expand All @@ -135,6 +159,7 @@ export default ({
<p>
<b>{amountOfResponses()}</b>
</p>
<p>{colorDistribution()}</p>
<p>
<Link to={`/report#${question.labelIndex}`} onClick={() => showWritten(question.id)}>
{t('report:clickToCheck')}
Expand Down

0 comments on commit b0db2f4

Please sign in to comment.