Skip to content

Commit 0b2349d

Browse files
committed
[ClassStats][Progress] Fix missing course names/codes
1 parent 55f18a4 commit 0b2349d

File tree

1 file changed

+4
-4
lines changed
  • services/frontend/src/components/PopulationStudents/StudentTable/ProgressTab

1 file changed

+4
-4
lines changed

services/frontend/src/components/PopulationStudents/StudentTable/ProgressTab/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const getCriteriaHeaders = (months: number, programme: string) => {
152152

153153
type Label = {
154154
code: string
155-
name: Name
155+
name: Name | null
156156
}
157157

158158
export const ProgressTable = ({
@@ -180,14 +180,14 @@ export const ProgressTable = ({
180180
const defaultCourses = keyBy(curriculum?.defaultProgrammeCourses, 'code')
181181
const coursesSecondProgramme = keyBy(curriculum?.secondProgrammeCourses, 'code')
182182

183-
const getCourseName = (courseCode: string): Name => {
183+
const getCourseName = (courseCode: string): Name | null => {
184184
if (defaultCourses[courseCode]) {
185185
return defaultCourses[courseCode].name
186186
}
187187
if (coursesSecondProgramme[courseCode]) {
188188
return coursesSecondProgramme[courseCode].name
189189
}
190-
return { fi: '', sv: '', en: '' }
190+
return null
191191
}
192192

193193
const labelCriteria = Object.keys(criteria?.courses ?? {}).reduce<Record<string, Label[]>>((acc, year, index) => {
@@ -308,7 +308,7 @@ export const ProgressTable = ({
308308
return (
309309
labels?.map(label =>
310310
columnHelper.accessor(() => undefined, {
311-
id: `${year}-${label.code}-${label.name.fi}`,
311+
id: `${year}-${label.code}-${label.name?.fi ?? ''}`,
312312
header: getTextIn(label.name) ?? label.code,
313313
cell: ({ row: { original: student } }) => {
314314
const title = label.code.includes('Criteria')

0 commit comments

Comments
 (0)