diff --git a/assets/translations/en.json b/assets/translations/en.json index 3f76c7d3..6849ee51 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -426,7 +426,8 @@ "noLocation": "Room to be defined", "notAvailable": "Booking not available", "notes": "Notes", - "title": "Exam call" + "title": "Exam call", + "noBookedCount": "Data not available" }, "examsScreen": { "emptyState": "There are no open exam calls", diff --git a/assets/translations/it.json b/assets/translations/it.json index 0e988c3f..83180785 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -426,7 +426,8 @@ "noLocation": "Aula da definire", "notAvailable": "Prenotazione non disponibile", "notes": "Note", - "title": "Appello" + "title": "Appello", + "noBookedCount": "Dato non disponibile" }, "examsScreen": { "emptyState": "Non ci sono appelli disponibili", diff --git a/src/features/teaching/screens/ExamScreen.tsx b/src/features/teaching/screens/ExamScreen.tsx index a00a0dd1..37795dc9 100644 --- a/src/features/teaching/screens/ExamScreen.tsx +++ b/src/features/teaching/screens/ExamScreen.tsx @@ -212,15 +212,13 @@ export const ExamScreen = ({ route, navigation }: Props) => { inverted /* check using undefined since the fields can be 0 */ title={ - exam?.availableCount !== undefined && exam?.bookedCount !== undefined ? getExam(exam.bookedCount, exam.availableCount) - : '' + : t('examScreen.noBookedCount') } subtitle={t('examScreen.bookedCount')} trailingItem={ exam?.status === ExamStatusEnum.Unavailable && - exam?.availableCount && exam.availableCount === 0 ? ( { }; export const getExam = (bookedCount: number, availableCount: number) => { - if (availableCount === 999) { + if (availableCount === undefined || availableCount === 999) { return `${bookedCount}`; } return `${bookedCount}/${availableCount + bookedCount}`;