mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
tweak: update rolling perofrmance
This commit is contained in:
@@ -97,6 +97,19 @@ describe("syncLessonsToGoogleCalendar", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("does not delete events during incremental sync", async () => {
|
||||
const result = await syncLessonsToGoogleCalendar(
|
||||
{ origin: ORIGIN, lessons: [baseLesson], mode: "incremental" },
|
||||
getAccessToken,
|
||||
);
|
||||
|
||||
expect(deleteGoogleCalendarEvent).not.toHaveBeenCalled();
|
||||
expect(result).toMatchObject({
|
||||
success: true,
|
||||
deleted: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it("reports progress while syncing", async () => {
|
||||
const progress: Array<{ phase: string; current: number; total: number }> = [];
|
||||
await syncLessonsToGoogleCalendar(
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
normalizeEventMapEntry,
|
||||
} from "@/seqta/utils/googleCalendar/eventMapEntry";
|
||||
import {
|
||||
droppedWeekRange,
|
||||
isDateInRange,
|
||||
syncWindowRange,
|
||||
} from "@/seqta/utils/googleCalendar/syncDateRange";
|
||||
@@ -120,7 +119,6 @@ function entriesToPrune(
|
||||
currentMapKeys: Set<string>,
|
||||
): Array<[string, string]> {
|
||||
const window = syncWindowRange(weeksAhead);
|
||||
const dropped = droppedWeekRange(weeksAhead);
|
||||
const prefix = `${origin}::`;
|
||||
const entries: Array<[string, string]> = [];
|
||||
|
||||
@@ -131,7 +129,7 @@ function entriesToPrune(
|
||||
|
||||
let shouldDelete = false;
|
||||
if (mode === "incremental") {
|
||||
shouldDelete = !!entry.date && isDateInRange(entry.date, dropped);
|
||||
shouldDelete = false;
|
||||
} else if (entry.date) {
|
||||
shouldDelete = !isDateInRange(entry.date, window);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user