Skip to content

Commit 198f5f2

Browse files
authored
Kl/scrum 147 fix timetable integration bugs (#103)
Co-authored-by: kevin-lann <[email protected]>
1 parent 5f2e0bb commit 198f5f2

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

course-matrix/backend/src/controllers/aiController.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
267267
- If the user provides a course code of length 6 like CSCA08, then assume they mean CSCA08H3 (H3 appended)
268268
- If the user wants to create a timetable, first call getCourses to get course information on the requested courses, then call generateTimetable.
269269
- Do not make up fake courses or offerings.
270+
- You can only edit title of the timetable, nothing else. If a user tries to edit something else, acknowledge this limitation.
270271
- For delete timetable requests, if the user asks to delete an ambiguous timetable name (i.e many with similar name exist) then ask them to clarify which one
271272
- For delete timetable requests, first check that the timetable the user is refering to exists
272273
- For delete timetable requests, ask for user confirmation with command "/timetable confirm" before proceeding. If their next message is anything other than "/timetable confim" then cancel the deletion.
@@ -285,13 +286,10 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
285286
},
286287
}),
287288
updateTimetable: tool({
288-
description: "Update a user's timetable by title and/or semester",
289+
description: "Update a user's timetable's title",
289290
parameters: z.object({
290291
id: z.number().positive(),
291292
timetable_title: z.string().optional(),
292-
semester: z
293-
.enum(["Fall 2025", "Summer 2025", "Winter 2026"])
294-
.optional(),
295293
}),
296294
execute: async (args) => {
297295
return await availableFunctions.updateTimetable(args, req);

course-matrix/frontend/src/pages/TimetableBuilder/TimetableBuilder.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,13 @@ const TimetableBuilder = () => {
370370
<Form {...form}>
371371
<FormContext.Provider value={form}>
372372
<form
373-
onSubmit={form.handleSubmit(handleGenerate)}
373+
onSubmit={form.handleSubmit(handleGenerate, (errors) => {
374+
console.error("Form submission errors:", errors);
375+
})}
374376
className="space-y-8"
375377
>
376378
<div className="flex gap-8 w-full">
377-
{/* <FormField
379+
<FormField
378380
control={form.control}
379381
name="semester"
380382
render={({ field }) => (
@@ -383,11 +385,13 @@ const TimetableBuilder = () => {
383385
<FormControl>
384386
<Select
385387
onValueChange={(value) => {
386-
form.reset({ offeringIds: [], courses: [] });
388+
form.setValue("offeringIds", []);
389+
form.setValue("courses", []);
387390
form.setValue("semester", value);
388391
}}
389392
value={field.value}
390393
defaultValue={field.value}
394+
disabled={isEditingTimetable}
391395
>
392396
<SelectTrigger className="w-[140px]">
393397
<SelectValue placeholder="Select a semester" />
@@ -406,7 +410,7 @@ const TimetableBuilder = () => {
406410
<FormMessage />
407411
</FormItem>
408412
)}
409-
/> */}
413+
/>
410414

411415
<FormField
412416
control={form.control}
@@ -437,7 +441,7 @@ const TimetableBuilder = () => {
437441
<p className="text-sm">
438442
Selected courses: {selectedCourses.length} (Max 8)
439443
</p>
440-
{!isEditingTimetable && (
444+
{!isEditingTimetable && !isGeneratingTimetables && (
441445
<div className="flex items-center gap-2">
442446
<Checkbox
443447
id="manual-selection"

0 commit comments

Comments
 (0)