Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: new semester should only clear category
Browse files Browse the repository at this point in the history
noahstreller committed Jan 31, 2025
1 parent 5e030cf commit 2dceb84
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/new-semester-button.tsx
Original file line number Diff line number Diff line change
@@ -33,8 +33,8 @@ import {
} from "@/lib/services/export-service";
import { exportToJSONFile } from "@/lib/services/notAsyncLogic";
import {
clearUserGrades,
clearUserSubjectsGrades,
clearUserGradesByCategory,
clearUserSubjectsGradesByCategory,
} from "@/lib/services/user-service";
import { CalendarPlus } from "lucide-react";
import { useTranslations } from "next-intl";
@@ -86,8 +86,10 @@ export const NewSemesterButton = ({
if (archiveData) {
await archiveCategory(data);
}
if (!keepSubjects) await clearUserSubjectsGrades();
if (!keepGrades && keepSubjects) await clearUserGrades();
if (!keepSubjects)
await clearUserSubjectsGradesByCategory(categoryState.category?.id!);
if (!keepGrades && keepSubjects)
await clearUserGradesByCategory(categoryState.category?.id!);
} finally {
setIsOpen(false);
window.location.reload();

0 comments on commit 2dceb84

Please sign in to comment.