From 46a0c8ddee12744023c15c1e387f94146e85e82f Mon Sep 17 00:00:00 2001 From: Carlos Valeriano Date: Thu, 18 Jan 2024 13:34:44 +0100 Subject: [PATCH] small fix for teacher options in start request form --- client/src/components/RequestForm.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/components/RequestForm.jsx b/client/src/components/RequestForm.jsx index 3ab4827..15c5ac5 100644 --- a/client/src/components/RequestForm.jsx +++ b/client/src/components/RequestForm.jsx @@ -114,6 +114,18 @@ function RequestForm(props) { const ChipProps = { sx: { height: 26 } }; + let teachersOptions; + + if (request) { + teachersOptions = teachers + .filter((teacher) => teacher.email !== request.supervisor) + .map((teacher) => teacher.email); + } else if (proposal) { + teachersOptions = teachers.filter((teacher) => teacher.id !== proposal.supervisor).map((teacher) => teacher.email); + } else { + teachersOptions = teachers.map((teacher) => teacher.email); + } + return ( {/* Title field */} @@ -187,7 +199,7 @@ function RequestForm(props) { teacher.email)} + options={teachersOptions} value={formData.coSupervisors} onChange={(event, value) => handleFormInputChange("coSupervisors", value)} ChipProps={ChipProps}