diff --git a/src/stories/hubbles_law/router.ts b/src/stories/hubbles_law/router.ts index 7d6c2eb..a6db5b3 100644 --- a/src/stories/hubbles_law/router.ts +++ b/src/stories/hubbles_law/router.ts @@ -188,7 +188,10 @@ router.delete("/sample-measurement/:studentID/:measurementNumber", async (req, r router.get("/measurements/:studentID", async (req, res) => { const params = req.params; const studentID = parseInt(params.studentID); - const measurements = await getStudentHubbleMeasurements(studentID); + const student = await findStudentById(studentID); + const measurements = student !== null ? + await getStudentHubbleMeasurements(studentID) : + null; const status = measurements === null ? 404 : 200; res.status(status).json({ student_id: studentID,