Skip to content

Commit

Permalink
fix(KUI-1196): change ternary conditional statement to normal conditi…
Browse files Browse the repository at this point in the history
…onal state using function
  • Loading branch information
amirhossein-haerian committed Jun 24, 2024
1 parent 7d8b921 commit aeccc99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion public/js/app/components/statistics/AnalysesSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ function Captions({ school, year, seasons }) {
},
} = useLanguage()

function getSchoolName(schoolName) {
if (schoolName === 'allSchools') return statisticsLabels[schoolName]
return schoolName
}

const seasonsStr = seasons.map(season => seasonLib.labelSeason(season, languageIndex)).join(', ')
return (
<Row>
<Col xs="4" style={{ flex: 'none', width: 'auto', paddingBottom: '20px' }}>
<label>{formSubHeaders.school}</label>
{`: ${school === 'allSchools' ? statisticsLabels[school] : school}`}
{`: ${getSchoolName(school)}`}
</Col>
<Col xs="4" style={{ flex: 'none', width: 'auto', paddingBottom: '20px' }}>
<label>{formSubHeaders.year}</label>
Expand Down
7 changes: 6 additions & 1 deletion public/js/app/components/statistics/MemosSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,19 @@ function Captions({ school, year, periods }) {
languageIndex,
} = useLanguage()

function getSchoolName(schoolName) {
if (schoolName === 'allSchools') return statisticsLabels[schoolName]
return schoolName
}

const periodsLabels = periods.map(period => periodsLib.labelPeriod(period, languageIndex, false))
const uniqquePeriodsLabels = [...new Set(periodsLabels)]
const periodsStr = uniqquePeriodsLabels.join(', ')
return (
<Row>
<Col xs="4" style={{ flex: 'none', width: 'auto', paddingBottom: '20px' }}>
<label>{formSubHeaders.school}</label>
{`: ${school === 'allSchools' ? statisticsLabels[school] : school}`}
{`: ${getSchoolName(school)}`}
</Col>
<Col xs="4" style={{ flex: 'none', width: 'auto', paddingBottom: '20px' }}>
<label>{formSubHeaders.year}</label>
Expand Down

0 comments on commit aeccc99

Please sign in to comment.