Skip to content

Commit b4be417

Browse files
committed
Return null if there is no active IEP instead of throwing
1 parent 560daf6 commit b4be417

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/backend/routers/student.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ test("getActiveStudentIep - return only one iep object", async (t) => {
100100
});
101101

102102
t.deepEqual(typeof studentWithIep, "object");
103-
t.is(studentWithIep.student_id, seed.student.student_id);
104-
t.deepEqual(studentWithIep.start_date, addedIep.start_date);
105-
t.deepEqual(studentWithIep.end_date, addedIep.end_date);
103+
t.is(studentWithIep?.student_id, seed.student.student_id);
104+
t.deepEqual(studentWithIep?.start_date, addedIep.start_date);
105+
t.deepEqual(studentWithIep?.end_date, addedIep.end_date);
106106
});

src/backend/routers/student.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export const student = router({
106106
.selectFrom("iep")
107107
.where("student_id", "=", student_id)
108108
.selectAll()
109-
.executeTakeFirstOrThrow();
109+
.executeTakeFirst();
110110

111-
return result;
111+
return result ?? null;
112112
}),
113113

114114
//for future CM's to not have access to a former CM's IEP data, we need a property on the IEP's for the case manager ID and only retrieve database data that matches the current CM's ID.

0 commit comments

Comments
 (0)