Skip to content

Commit bb731a7

Browse files
authored
fix: Update pupil and student calendar preferences to handle null values (#936)
1 parent 5c46bb6 commit bb731a7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/pages/screening/pupil/useUpdatePupil.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const useUpdatePupil = (pupil: PupilForScreening) => {
4141
gradeAsInt: grade,
4242
subjects: subjects.map((e) => ({ name: e.name, grade: e.grade, mandatory: e.mandatory })),
4343
languages: languages as any,
44-
onlyMatchWith: onlyMatchWithWomen === true ? Gender.Female : (undefined as any),
44+
onlyMatchWith: onlyMatchWithWomen === true ? Gender.Female : (null as any),
4545
hasSpecialNeeds: hasSpecialNeeds === true,
4646
school: {
4747
name: school?.name,
@@ -54,7 +54,7 @@ export const useUpdatePupil = (pupil: PupilForScreening) => {
5454
descriptionForScreening,
5555
isPupil: canHaveMatches,
5656
isParticipant: canParticipateInCourses,
57-
calendarPreferences: pupil.calendarPreferences
57+
calendarPreferences: weeklyAvailability
5858
? {
5959
...pupil.calendarPreferences,
6060
weeklyAvailability: weeklyAvailability!,

src/pages/screening/student/PersonalDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const PersonalDetails = ({ student, refresh }: PersonalDetailsProps) => {
123123
descriptionForScreening,
124124
state: location as any,
125125
zipCode: zipCode !== '' ? zipCode : null,
126-
calendarPreferences: student.calendarPreferences
126+
calendarPreferences: weeklyAvailability
127127
? {
128128
...student.calendarPreferences,
129129
weeklyAvailability: weeklyAvailability!,

0 commit comments

Comments
 (0)