Skip to content

Commit 8f95a66

Browse files
committed
hotfix: schedule search results ordering
1 parent 758e6c6 commit 8f95a66

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

apps/web/src/lib/components/recal/Top.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
await Promise.all(secondaryPromises);
5151
5252
if ($schedules[term].length > 0 && term === $currentTerm) {
53-
currentSchedule.set($schedules[term][0].id);
53+
// Use handleScheduleChange instead of just setting currentSchedule
54+
// This ensures searchCourseData is properly filtered for the current schedule
55+
handleScheduleChange($schedules[term][0].id);
5456
}
5557
5658
$ready = true;
@@ -90,6 +92,9 @@
9092
return s;
9193
});
9294
await persistScheduleOrder();
95+
96+
// Re-sync searchCourseData with current schedule after reorder
97+
handleScheduleChange($currentSchedule);
9398
}
9499
95100
async function persistScheduleOrder() {

apps/web/src/lib/stores/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ function createScheduleEventStore() {
502502
targetId: number
503503
): Promise<boolean> => {
504504
const sourceEvents = get(store)[sourceId];
505-
if (sourceEvents === null) {
505+
if (sourceEvents == null) {
506506
console.error("Source schedule not found while duplicating");
507507
return false;
508508
}

apps/web/src/routes/(apps)/recalplus/+page.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export const load = async ({ locals: { supabase } }) => {
3939
supaPromises.push(
4040
supabase
4141
.from("schedules")
42-
.select("id, title")
42+
.select("id, title, display_order")
4343
.eq("user_id", userId)
4444
.eq("term", CURRENT_TERM_ID)
45-
.order("id", { ascending: true })
45+
.order("display_order", { ascending: true })
4646
);
4747
supaPromises.push(
4848
supabase

0 commit comments

Comments
 (0)