From 1c253e99671fa94571cf7f73d53422af5e9e5dda Mon Sep 17 00:00:00 2001 From: Alec Li Date: Sun, 11 Aug 2024 21:52:14 -0700 Subject: [PATCH] Add matcher slot description, reformat match solver --- .../EnrollmentAutomationTypes.tsx | 1 + .../MentorSectionPreferences.tsx | 13 ++++- .../coordinator/CoordinatorMatcherForm.tsx | 5 +- .../coordinator/CreateStage.tsx | 49 +++++++++++++++++-- .../frontend/src/css/enrollment_matcher.scss | 17 ++++++- .../frontend/src/utils/queries/matcher.tsx | 1 + .../0033_matcherslot_description.py | 17 +++++++ csm_web/scheduler/models.py | 13 ++--- csm_web/scheduler/serializers.py | 2 +- csm_web/scheduler/utils/match_solver.py | 44 +++++++++++------ csm_web/scheduler/views/matcher.py | 14 +++++- 11 files changed, 142 insertions(+), 34 deletions(-) create mode 100644 csm_web/scheduler/migrations/0033_matcherslot_description.py diff --git a/csm_web/frontend/src/components/enrollment_automation/EnrollmentAutomationTypes.tsx b/csm_web/frontend/src/components/enrollment_automation/EnrollmentAutomationTypes.tsx index 13d8b971..0e945e6f 100644 --- a/csm_web/frontend/src/components/enrollment_automation/EnrollmentAutomationTypes.tsx +++ b/csm_web/frontend/src/components/enrollment_automation/EnrollmentAutomationTypes.tsx @@ -9,6 +9,7 @@ export interface Time { export interface Slot { id?: number; times: Time[]; + description?: string; [key: string]: any; } diff --git a/csm_web/frontend/src/components/enrollment_automation/MentorSectionPreferences.tsx b/csm_web/frontend/src/components/enrollment_automation/MentorSectionPreferences.tsx index b2451ea9..f48274ae 100644 --- a/csm_web/frontend/src/components/enrollment_automation/MentorSectionPreferences.tsx +++ b/csm_web/frontend/src/components/enrollment_automation/MentorSectionPreferences.tsx @@ -67,7 +67,8 @@ export function MentorSectionPreferences({ id: slot.id, // replace single quotes for JSON times: times, - preference: 0 + preference: 0, + description: slot.description }; newSlots.push(parsed_slot); } @@ -169,7 +170,7 @@ export function MentorSectionPreferences({ const event = selectedEvents[0]; sidebarContents = (
-
+
{selectedEvents.length === 1 ? ( // exactly one selected event @@ -188,6 +189,14 @@ export function MentorSectionPreferences({ // multiple selected events
Multiple selected events
)} +
+ {event.description !== "" && ( + <> +
Description:
+
{event.description}
+ + )} +
+
+
Description:
+
+ setCurSlotDescription(e.target.value)} + /> +
+
@@ -677,6 +701,17 @@ export function CreateStage({ profile, initialSlots, nextStage }: CreateStagePro ))}
+
+
Description:
+
+ setCurSlotDescription(e.target.value)} + /> +
+