mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
feat: sync assement due dates to calendar
This commit is contained in:
1 parent
56571b7597
commit
1ba5f1ef49
13 files changed
+498
-19
No files matched your search
@@ -29,6 +29,7 @@ import {
|
|||||||
CALENDAR_WEEKLY_ALARM,
|
CALENDAR_WEEKLY_ALARM,
|
||||||
clampSyncWeeks,
|
clampSyncWeeks,
|
||||||
getAutoSyncWeekly,
|
getAutoSyncWeekly,
|
||||||
|
getSyncAssessmentDueDates,
|
||||||
getSyncWeeksAhead,
|
getSyncWeeksAhead,
|
||||||
isAnyCalendarConnected,
|
isAnyCalendarConnected,
|
||||||
markWeeklySyncPending,
|
markWeeklySyncPending,
|
||||||
@@ -324,12 +325,14 @@ export function registerTrustedAsyncHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
|
async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
|
||||||
const [state, shared, syncWeeksAhead, autoSyncWeekly] = await Promise.all([
|
const [state, shared, syncWeeksAhead, autoSyncWeekly, syncAssessmentDueDates] =
|
||||||
readGoogleCalendarState(),
|
await Promise.all([
|
||||||
readSharedCalendarSyncSettings(),
|
readGoogleCalendarState(),
|
||||||
getSyncWeeksAhead(),
|
readSharedCalendarSyncSettings(),
|
||||||
getAutoSyncWeekly(),
|
getSyncWeeksAhead(),
|
||||||
]);
|
getAutoSyncWeekly(),
|
||||||
|
getSyncAssessmentDueDates(),
|
||||||
|
]);
|
||||||
return {
|
return {
|
||||||
configured: isGoogleCalendarConfigured(),
|
configured: isGoogleCalendarConfigured(),
|
||||||
connected: !!(state.refreshToken || state.accessToken),
|
connected: !!(state.refreshToken || state.accessToken),
|
||||||
@@ -338,6 +341,7 @@ async function getGoogleCalendarStatus(): Promise<GoogleCalendarStatus> {
|
|||||||
lastSyncOrigin: state.lastSyncOrigin,
|
lastSyncOrigin: state.lastSyncOrigin,
|
||||||
syncWeeksAhead,
|
syncWeeksAhead,
|
||||||
autoSyncWeekly,
|
autoSyncWeekly,
|
||||||
|
syncAssessmentDueDates,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,10 +483,17 @@ export function registerGoogleCalendarMessageHandlers(
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarUpdateSyncSettings", async (request) => {
|
registerTrustedAsyncHandler(handlers, isTrustedSender, "googleCalendarUpdateSyncSettings", async (request) => {
|
||||||
const body = request as { syncWeeksAhead?: number; autoSyncWeekly?: boolean };
|
const body = request as {
|
||||||
|
syncWeeksAhead?: number;
|
||||||
|
autoSyncWeekly?: boolean;
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
|
};
|
||||||
const patch: Record<string, unknown> = {};
|
const patch: Record<string, unknown> = {};
|
||||||
if (body.syncWeeksAhead != null) patch.syncWeeksAhead = clampSyncWeeks(body.syncWeeksAhead);
|
if (body.syncWeeksAhead != null) patch.syncWeeksAhead = clampSyncWeeks(body.syncWeeksAhead);
|
||||||
if (body.autoSyncWeekly != null) patch.autoSyncWeekly = !!body.autoSyncWeekly;
|
if (body.autoSyncWeekly != null) patch.autoSyncWeekly = !!body.autoSyncWeekly;
|
||||||
|
if (body.syncAssessmentDueDates != null) {
|
||||||
|
patch.syncAssessmentDueDates = !!body.syncAssessmentDueDates;
|
||||||
|
}
|
||||||
if (Object.keys(patch).length > 0) await writeSharedCalendarSyncSettings(patch);
|
if (Object.keys(patch).length > 0) await writeSharedCalendarSyncSettings(patch);
|
||||||
await ensureWeeklySyncAlarm();
|
await ensureWeeklySyncAlarm();
|
||||||
return { success: true, ...(await getGoogleCalendarStatus()) };
|
return { success: true, ...(await getGoogleCalendarStatus()) };
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
let syncProgress = $state<GoogleCalendarSyncProgress | null>(null);
|
let syncProgress = $state<GoogleCalendarSyncProgress | null>(null);
|
||||||
let syncWeeksAhead = $state(12);
|
let syncWeeksAhead = $state(12);
|
||||||
let autoSyncWeekly = $state(true);
|
let autoSyncWeekly = $state(true);
|
||||||
|
let syncAssessmentDueDates = $state(false);
|
||||||
|
|
||||||
let rootEl = $state<HTMLDivElement | null>(null);
|
let rootEl = $state<HTMLDivElement | null>(null);
|
||||||
let triggerEl = $state<HTMLButtonElement | null>(null);
|
let triggerEl = $state<HTMLButtonElement | null>(null);
|
||||||
@@ -159,6 +160,7 @@
|
|||||||
outlookStatus = outlook;
|
outlookStatus = outlook;
|
||||||
syncWeeksAhead = google.syncWeeksAhead ?? 12;
|
syncWeeksAhead = google.syncWeeksAhead ?? 12;
|
||||||
autoSyncWeekly = google.autoSyncWeekly !== false;
|
autoSyncWeekly = google.autoSyncWeekly !== false;
|
||||||
|
syncAssessmentDueDates = google.syncAssessmentDueDates === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSyncProgress(progress: GoogleCalendarSyncProgress) {
|
function handleSyncProgress(progress: GoogleCalendarSyncProgress) {
|
||||||
@@ -168,10 +170,14 @@
|
|||||||
async function saveSyncSettings(patch: {
|
async function saveSyncSettings(patch: {
|
||||||
syncWeeksAhead?: number;
|
syncWeeksAhead?: number;
|
||||||
autoSyncWeekly?: boolean;
|
autoSyncWeekly?: boolean;
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const result = await updateGoogleSyncSettings(patch);
|
const result = await updateGoogleSyncSettings(patch);
|
||||||
if (result.syncWeeksAhead != null) syncWeeksAhead = result.syncWeeksAhead;
|
if (result.syncWeeksAhead != null) syncWeeksAhead = result.syncWeeksAhead;
|
||||||
if (result.autoSyncWeekly != null) autoSyncWeekly = result.autoSyncWeekly;
|
if (result.autoSyncWeekly != null) autoSyncWeekly = result.autoSyncWeekly;
|
||||||
|
if (result.syncAssessmentDueDates != null) {
|
||||||
|
syncAssessmentDueDates = result.syncAssessmentDueDates;
|
||||||
|
}
|
||||||
googleStatus = { ...googleStatus, ...result };
|
googleStatus = { ...googleStatus, ...result };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +307,12 @@
|
|||||||
await saveSyncSettings({ autoSyncWeekly: checked });
|
await saveSyncSettings({ autoSyncWeekly: checked });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onAssessmentDueDatesToggle(event: Event) {
|
||||||
|
const checked = (event.currentTarget as HTMLInputElement).checked;
|
||||||
|
syncAssessmentDueDates = checked;
|
||||||
|
await saveSyncSettings({ syncAssessmentDueDates: checked });
|
||||||
|
}
|
||||||
|
|
||||||
async function disconnectProvider(
|
async function disconnectProvider(
|
||||||
provider: CalendarProvider,
|
provider: CalendarProvider,
|
||||||
label: string,
|
label: string,
|
||||||
@@ -588,7 +600,10 @@
|
|||||||
>
|
>
|
||||||
<div class="bsplus-cal-menu-header">
|
<div class="bsplus-cal-menu-header">
|
||||||
<span class="bsplus-cal-menu-title">Calendar sync</span>
|
<span class="bsplus-cal-menu-title">Calendar sync</span>
|
||||||
<span class="bsplus-cal-menu-sub">Copy your SEQTA classes and appointments to Google or Outlook</span>
|
<span class="bsplus-cal-menu-sub"
|
||||||
|
>Copy your SEQTA classes, appointments, and optional assessment due dates to Google or
|
||||||
|
Outlook</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{@render providerPanel(
|
{@render providerPanel(
|
||||||
@@ -640,6 +655,22 @@
|
|||||||
onchange={(e) => void onAutoSyncToggle(e)}
|
onchange={(e) => void onAutoSyncToggle(e)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="bsplus-cal-setting bsplus-cal-setting--toggle">
|
||||||
|
<div class="bsplus-cal-setting-copy">
|
||||||
|
<span class="bsplus-cal-setting-label">Sync assessment due dates</span>
|
||||||
|
<span class="bsplus-cal-setting-desc">
|
||||||
|
Add upcoming assessment due dates from SEQTA using the same weeks window. Run Update
|
||||||
|
calendar after enabling to backfill.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="bsplus-cal-setting-checkbox"
|
||||||
|
checked={syncAssessmentDueDates}
|
||||||
|
disabled={isBusy}
|
||||||
|
onchange={(e) => void onAssessmentDueDatesToggle(e)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,12 +19,14 @@ export const WHATS_NEW_CHANGELOG: WhatsNewRelease[] = [
|
|||||||
"Fixed the look and feel of the sidebar to be more like how it used to be.",
|
"Fixed the look and feel of the sidebar to be more like how it used to be.",
|
||||||
"Added a few new loading screens you will see when opening SEQTA with BetterSEQTA",
|
"Added a few new loading screens you will see when opening SEQTA with BetterSEQTA",
|
||||||
"Added an option in the Timetable to sync to Google Calendar and Outlook Calendar",
|
"Added an option in the Timetable to sync to Google Calendar and Outlook Calendar",
|
||||||
|
"Added an optional setting to sync assessment due dates to your connected calendar.",
|
||||||
"Added a new sidebar customisation page in the settings menu to change the sidebar layout, icons, and more.",
|
"Added a new sidebar customisation page in the settings menu to change the sidebar layout, icons, and more.",
|
||||||
"Added extension feedback in settings.",
|
"Added extension feedback in settings.",
|
||||||
"Added a new toggleable titlebar founder badge to the topbar for BetterSEQTA Cloud celebrations.",
|
"Added a new toggleable titlebar founder badge to the topbar for BetterSEQTA Cloud celebrations.",
|
||||||
"Addded Editing a teacher's name in the timetable editor now affect Assements.",
|
"Addded Editing a teacher's name in the timetable editor now affect Assements.",
|
||||||
"Added a 'this year' & custom date range option to grade analyitics.",
|
"Added a 'this year' & custom date range option to grade analyitics.",
|
||||||
"Added Community Themes for you all to show off your best BetterSEQTA setups!",
|
"Added Community Themes for you all to show off your best BetterSEQTA setups!",
|
||||||
|
"Added combined class groups in Grade Analytics to merge multiple subjects into one trend.",
|
||||||
"Removed white background around SEQTA Learn mobile App icons in settings.",
|
"Removed white background around SEQTA Learn mobile App icons in settings.",
|
||||||
"Re-added the kitten back to the 404 Error pages.",
|
"Re-added the kitten back to the 404 Error pages.",
|
||||||
"Improved the sidebar to be more stable and performant.",
|
"Improved the sidebar to be more stable and performant.",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
buildLessonSyncResult,
|
buildLessonSyncResult,
|
||||||
collectOriginDeleteEntries,
|
collectOriginDeleteEntries,
|
||||||
|
assessmentEntriesToRemove,
|
||||||
entriesToPrune,
|
entriesToPrune,
|
||||||
formatLessonSyncResultMessage,
|
formatLessonSyncResultMessage,
|
||||||
mapPool,
|
mapPool,
|
||||||
@@ -111,6 +112,37 @@ describe("entriesToPrune", () => {
|
|||||||
);
|
);
|
||||||
expect(pruned).toEqual([[staleKey, "evt-old"]]);
|
expect(pruned).toEqual([[staleKey, "evt-old"]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("skips assessment keys when assessment sync is disabled", () => {
|
||||||
|
const assessmentKey = `${origin}::${origin}:assessment:99`;
|
||||||
|
const pruned = entriesToPrune(
|
||||||
|
{ [assessmentKey]: { id: "evt-a", date: syncDate } },
|
||||||
|
origin,
|
||||||
|
"full",
|
||||||
|
weeksAhead,
|
||||||
|
new Set(),
|
||||||
|
{ syncAssessmentDueDates: false },
|
||||||
|
);
|
||||||
|
expect(pruned).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("assessmentEntriesToRemove", () => {
|
||||||
|
const origin = "https://school.seqta.com.au";
|
||||||
|
|
||||||
|
it("lists all assessment map entries for the origin", () => {
|
||||||
|
const lessonKey = `${origin}::${origin}:cal:1`;
|
||||||
|
const assessmentKey = `${origin}::${origin}:assessment:3`;
|
||||||
|
expect(
|
||||||
|
assessmentEntriesToRemove(
|
||||||
|
{
|
||||||
|
[lessonKey]: { id: "evt-1", date: "2026-01-01" },
|
||||||
|
[assessmentKey]: { id: "evt-a", date: "2026-02-01" },
|
||||||
|
},
|
||||||
|
origin,
|
||||||
|
),
|
||||||
|
).toEqual([[assessmentKey, "evt-a"]]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("mergeRemoteEventsIntoMap", () => {
|
describe("mergeRemoteEventsIntoMap", () => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from "@/seqta/utils/calendarSync/eventMap";
|
} from "@/seqta/utils/calendarSync/eventMap";
|
||||||
import { eventFingerprint } from "@/seqta/utils/calendarSync/eventFingerprint";
|
import { eventFingerprint } from "@/seqta/utils/calendarSync/eventFingerprint";
|
||||||
import type { RemoteSyncedEvent } from "@/seqta/utils/calendarSync/remoteEvents";
|
import type { RemoteSyncedEvent } from "@/seqta/utils/calendarSync/remoteEvents";
|
||||||
|
import { isAssessmentSeqtaKey } from "@/seqta/utils/googleCalendar/assessmentEventMapper";
|
||||||
import {
|
import {
|
||||||
isDateInRange,
|
isDateInRange,
|
||||||
syncWindowRange,
|
syncWindowRange,
|
||||||
@@ -85,21 +86,32 @@ export function originEventMapEntries(
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type EntriesToPruneOptions = {
|
||||||
|
/** When false, assessment events are not pruned here (use assessmentEntriesToRemove). */
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export function entriesToPrune(
|
export function entriesToPrune(
|
||||||
eventMap: EventMapRecord,
|
eventMap: EventMapRecord,
|
||||||
origin: string,
|
origin: string,
|
||||||
mode: "full" | "incremental",
|
mode: "full" | "incremental",
|
||||||
weeksAhead: number,
|
weeksAhead: number,
|
||||||
currentMapKeys: Set<string>,
|
currentMapKeys: Set<string>,
|
||||||
|
options: EntriesToPruneOptions = {},
|
||||||
): Array<[string, string]> {
|
): Array<[string, string]> {
|
||||||
if (mode === "incremental") return [];
|
if (mode === "incremental") return [];
|
||||||
|
|
||||||
|
const syncAssessments = options.syncAssessmentDueDates === true;
|
||||||
const window = syncWindowRange(weeksAhead);
|
const window = syncWindowRange(weeksAhead);
|
||||||
const prefix = `${origin}::`;
|
const prefix = `${origin}::`;
|
||||||
const entries: Array<[string, string]> = [];
|
const entries: Array<[string, string]> = [];
|
||||||
|
|
||||||
for (const [mapKey, raw] of Object.entries(eventMap)) {
|
for (const [mapKey, raw] of Object.entries(eventMap)) {
|
||||||
if (!mapKey.startsWith(prefix)) continue;
|
if (!mapKey.startsWith(prefix)) continue;
|
||||||
|
const seqtaKey = mapKey.slice(prefix.length);
|
||||||
|
const isAssessment = isAssessmentSeqtaKey(seqtaKey);
|
||||||
|
if (isAssessment && !syncAssessments) continue;
|
||||||
|
|
||||||
const entry = normalizeEventMapEntry(raw);
|
const entry = normalizeEventMapEntry(raw);
|
||||||
if (!entry) continue;
|
if (!entry) continue;
|
||||||
const missingFromTimetable = !currentMapKeys.has(mapKey);
|
const missingFromTimetable = !currentMapKeys.has(mapKey);
|
||||||
@@ -112,6 +124,26 @@ export function entriesToPrune(
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove all tracked assessment events when due-date sync is turned off. */
|
||||||
|
export function assessmentEntriesToRemove(
|
||||||
|
eventMap: EventMapRecord,
|
||||||
|
origin: string,
|
||||||
|
): Array<[string, string]> {
|
||||||
|
const prefix = `${origin}::`;
|
||||||
|
const entries: Array<[string, string]> = [];
|
||||||
|
|
||||||
|
for (const [mapKey, raw] of Object.entries(eventMap)) {
|
||||||
|
if (!mapKey.startsWith(prefix)) continue;
|
||||||
|
const seqtaKey = mapKey.slice(prefix.length);
|
||||||
|
if (!isAssessmentSeqtaKey(seqtaKey)) continue;
|
||||||
|
const entry = normalizeEventMapEntry(raw);
|
||||||
|
if (!entry) continue;
|
||||||
|
entries.push([mapKey, entry.id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
/** Merge remote BS+ events into the local eventMap (origin-scoped keys). */
|
/** Merge remote BS+ events into the local eventMap (origin-scoped keys). */
|
||||||
export function mergeRemoteEventsIntoMap(
|
export function mergeRemoteEventsIntoMap(
|
||||||
eventMap: EventMapRecord,
|
eventMap: EventMapRecord,
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export const WEEKLY_SYNC_INTERVAL_MS = 7 * 24 * 60 * 60 * 1000;
|
|||||||
export interface SharedCalendarSyncSettings {
|
export interface SharedCalendarSyncSettings {
|
||||||
syncWeeksAhead?: number;
|
syncWeeksAhead?: number;
|
||||||
autoSyncWeekly?: boolean;
|
autoSyncWeekly?: boolean;
|
||||||
|
/** When true, sync assessment due dates alongside timetable events. */
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
lastWeeklySyncAt?: number;
|
lastWeeklySyncAt?: number;
|
||||||
pendingWeeklySync?: boolean;
|
pendingWeeklySync?: boolean;
|
||||||
}
|
}
|
||||||
@@ -68,6 +70,11 @@ export async function getAutoSyncWeekly(): Promise<boolean> {
|
|||||||
return settings.autoSyncWeekly !== false;
|
return settings.autoSyncWeekly !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getSyncAssessmentDueDates(): Promise<boolean> {
|
||||||
|
const settings = await readSharedCalendarSyncSettings();
|
||||||
|
return settings.syncAssessmentDueDates === true;
|
||||||
|
}
|
||||||
|
|
||||||
export async function isAnyCalendarConnected(): Promise<boolean> {
|
export async function isAnyCalendarConnected(): Promise<boolean> {
|
||||||
const [google, outlook] = await Promise.all([
|
const [google, outlook] = await Promise.all([
|
||||||
readGoogleCalendarState(),
|
readGoogleCalendarState(),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { getSyncWeeksAhead } from "@/seqta/utils/calendarSync/settings";
|
|||||||
import { eventMapKey } from "@/seqta/utils/calendarSync/eventMap";
|
import { eventMapKey } from "@/seqta/utils/calendarSync/eventMap";
|
||||||
import type { EventMapRecord } from "@/seqta/utils/calendarSync/eventMap";
|
import type { EventMapRecord } from "@/seqta/utils/calendarSync/eventMap";
|
||||||
import {
|
import {
|
||||||
|
assessmentEntriesToRemove,
|
||||||
buildDeleteSyncResult,
|
buildDeleteSyncResult,
|
||||||
buildLessonSyncResult,
|
buildLessonSyncResult,
|
||||||
clearOriginEventMapEntries,
|
clearOriginEventMapEntries,
|
||||||
@@ -18,6 +19,7 @@ import {
|
|||||||
reportSyncProgress,
|
reportSyncProgress,
|
||||||
upsertLessonEvents,
|
upsertLessonEvents,
|
||||||
} from "@/seqta/utils/calendarSync/lessonSyncShared";
|
} from "@/seqta/utils/calendarSync/lessonSyncShared";
|
||||||
|
import { mapAssessmentsToGoogleEvents } from "@/seqta/utils/googleCalendar/assessmentEventMapper";
|
||||||
import {
|
import {
|
||||||
deleteGoogleCalendarEvent,
|
deleteGoogleCalendarEvent,
|
||||||
deleteOutlookCalendarEvent,
|
deleteOutlookCalendarEvent,
|
||||||
@@ -171,7 +173,14 @@ export async function syncLessonsToCalendar(
|
|||||||
const mode = request.mode ?? "full";
|
const mode = request.mode ?? "full";
|
||||||
const weeksAhead = request.weeksAhead ?? (await getSyncWeeksAhead());
|
const weeksAhead = request.weeksAhead ?? (await getSyncWeeksAhead());
|
||||||
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
||||||
const events = mapLessonsToGoogleEvents(request.origin, request.lessons, timeZone);
|
const syncAssessmentDueDates = request.syncAssessmentDueDates === true;
|
||||||
|
let events = mapLessonsToGoogleEvents(request.origin, request.lessons, timeZone);
|
||||||
|
if (syncAssessmentDueDates && request.assessments?.length) {
|
||||||
|
events = [
|
||||||
|
...events,
|
||||||
|
...mapAssessmentsToGoogleEvents(request.origin, request.assessments, timeZone),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
reportSyncProgress(options.onProgress, {
|
reportSyncProgress(options.onProgress, {
|
||||||
phase: "preparing",
|
phase: "preparing",
|
||||||
@@ -204,7 +213,17 @@ export async function syncLessonsToCalendar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentMapKeys = new Set(events.map((event) => eventMapKey(request.origin, event.seqtaKey)));
|
const currentMapKeys = new Set(events.map((event) => eventMapKey(request.origin, event.seqtaKey)));
|
||||||
const staleEntries = entriesToPrune(eventMap, request.origin, mode, weeksAhead, currentMapKeys);
|
let staleEntries = entriesToPrune(
|
||||||
|
eventMap,
|
||||||
|
request.origin,
|
||||||
|
mode,
|
||||||
|
weeksAhead,
|
||||||
|
currentMapKeys,
|
||||||
|
{ syncAssessmentDueDates },
|
||||||
|
);
|
||||||
|
if (!syncAssessmentDueDates && mode === "full") {
|
||||||
|
staleEntries = [...staleEntries, ...assessmentEntriesToRemove(eventMap, request.origin)];
|
||||||
|
}
|
||||||
const totalSteps = Math.max(staleEntries.length + events.length, 1);
|
const totalSteps = Math.max(staleEntries.length + events.length, 1);
|
||||||
const lastSyncAt = Date.now();
|
const lastSyncAt = Date.now();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import browser from "webextension-polyfill";
|
import browser from "webextension-polyfill";
|
||||||
import { fetchTimetableForSync, fetchTimetableLessons } from "@/seqta/utils/googleCalendar/fetchTimetable";
|
import { fetchTimetableForSync, fetchTimetableLessons } from "@/seqta/utils/googleCalendar/fetchTimetable";
|
||||||
import { trailingWeekRange } from "@/seqta/utils/googleCalendar/syncDateRange";
|
import { syncWindowRange, trailingWeekRange } from "@/seqta/utils/googleCalendar/syncDateRange";
|
||||||
import {
|
import {
|
||||||
googleLessonSyncProvider,
|
googleLessonSyncProvider,
|
||||||
outlookLessonSyncProvider,
|
outlookLessonSyncProvider,
|
||||||
@@ -15,9 +15,11 @@ import {
|
|||||||
} from "@/seqta/utils/calendarSync/providerStorage";
|
} from "@/seqta/utils/calendarSync/providerStorage";
|
||||||
import {
|
import {
|
||||||
BSPLUS_CALENDAR_SYNC_IN_PROGRESS_KEY,
|
BSPLUS_CALENDAR_SYNC_IN_PROGRESS_KEY,
|
||||||
|
getSyncAssessmentDueDates,
|
||||||
getSyncWeeksAhead,
|
getSyncWeeksAhead,
|
||||||
readResumableCalendarSync,
|
readResumableCalendarSync,
|
||||||
} from "@/seqta/utils/calendarSync/settings";
|
} from "@/seqta/utils/calendarSync/settings";
|
||||||
|
import { fetchAssessmentsForCalendarSync } from "@/seqta/utils/googleCalendar/fetchAssessmentsForCalendarSync";
|
||||||
import type {
|
import type {
|
||||||
GoogleCalendarStatus,
|
GoogleCalendarStatus,
|
||||||
GoogleCalendarSyncProgress,
|
GoogleCalendarSyncProgress,
|
||||||
@@ -63,6 +65,7 @@ export async function fetchCalendarStatuses(): Promise<{
|
|||||||
export async function updateGoogleSyncSettings(patch: {
|
export async function updateGoogleSyncSettings(patch: {
|
||||||
syncWeeksAhead?: number;
|
syncWeeksAhead?: number;
|
||||||
autoSyncWeekly?: boolean;
|
autoSyncWeekly?: boolean;
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
}): Promise<GoogleCalendarStatus & { success?: boolean }> {
|
}): Promise<GoogleCalendarStatus & { success?: boolean }> {
|
||||||
return sendMessage("googleCalendarUpdateSyncSettings", patch);
|
return sendMessage("googleCalendarUpdateSyncSettings", patch);
|
||||||
}
|
}
|
||||||
@@ -123,14 +126,30 @@ export async function runCalendarSync(
|
|||||||
message: mode === "incremental" ? "Fetching new week…" : "Fetching timetable…",
|
message: mode === "incremental" ? "Fetching new week…" : "Fetching timetable…",
|
||||||
});
|
});
|
||||||
|
|
||||||
const lessons =
|
const assessmentRange =
|
||||||
|
mode === "incremental" ? trailingWeekRange(weeksAhead) : syncWindowRange(weeksAhead);
|
||||||
|
|
||||||
|
const [lessons, syncAssessmentDueDates] = await Promise.all([
|
||||||
mode === "incremental"
|
mode === "incremental"
|
||||||
? await fetchTimetableLessons(trailingWeekRange(weeksAhead))
|
? fetchTimetableLessons(assessmentRange)
|
||||||
: await fetchTimetableForSync(weeksAhead);
|
: fetchTimetableForSync(weeksAhead),
|
||||||
|
getSyncAssessmentDueDates(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const assessments = syncAssessmentDueDates
|
||||||
|
? await fetchAssessmentsForCalendarSync(assessmentRange)
|
||||||
|
: [];
|
||||||
|
|
||||||
return await syncLessonsToCalendar(
|
return await syncLessonsToCalendar(
|
||||||
config.lessonSyncProvider,
|
config.lessonSyncProvider,
|
||||||
{ origin: location.origin, lessons, mode, weeksAhead },
|
{
|
||||||
|
origin: location.origin,
|
||||||
|
lessons,
|
||||||
|
assessments,
|
||||||
|
syncAssessmentDueDates,
|
||||||
|
mode,
|
||||||
|
weeksAhead,
|
||||||
|
},
|
||||||
() => getCalendarAccessToken(config.provider),
|
() => getCalendarAccessToken(config.provider),
|
||||||
{ onProgress: params.onProgress },
|
{ onProgress: params.onProgress },
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import { describe, expect, it } from "@jest/globals";
|
||||||
|
import {
|
||||||
|
assessmentToGoogleEvent,
|
||||||
|
mapAssessmentsToGoogleEvents,
|
||||||
|
seqtaAssessmentKey,
|
||||||
|
shouldSyncAssessment,
|
||||||
|
} from "./assessmentEventMapper";
|
||||||
|
|
||||||
|
const ORIGIN = "https://school.seqta.com.au";
|
||||||
|
|
||||||
|
describe("shouldSyncAssessment", () => {
|
||||||
|
it("accepts upcoming assessments with due dates", () => {
|
||||||
|
expect(
|
||||||
|
shouldSyncAssessment({
|
||||||
|
id: 1,
|
||||||
|
title: "Essay",
|
||||||
|
subject: "English",
|
||||||
|
code: "10ENG",
|
||||||
|
due: "2026-06-27",
|
||||||
|
}),
|
||||||
|
).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects released marks", () => {
|
||||||
|
expect(
|
||||||
|
shouldSyncAssessment({
|
||||||
|
id: 2,
|
||||||
|
title: "Test",
|
||||||
|
subject: "Math",
|
||||||
|
code: "10MAT",
|
||||||
|
due: "2026-06-27",
|
||||||
|
status: "MARKS_RELEASED",
|
||||||
|
}),
|
||||||
|
).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("assessmentToGoogleEvent", () => {
|
||||||
|
it("maps date-only due dates to all-day events", () => {
|
||||||
|
const event = assessmentToGoogleEvent(
|
||||||
|
ORIGIN,
|
||||||
|
{
|
||||||
|
id: 42,
|
||||||
|
title: "Project",
|
||||||
|
subject: "Science",
|
||||||
|
code: "10SCI",
|
||||||
|
due: "2026-06-27",
|
||||||
|
},
|
||||||
|
"Australia/Perth",
|
||||||
|
);
|
||||||
|
expect(event).toMatchObject({
|
||||||
|
seqtaKey: seqtaAssessmentKey(ORIGIN, 42),
|
||||||
|
allDay: true,
|
||||||
|
startDate: "2026-06-27",
|
||||||
|
endDate: "2026-06-28",
|
||||||
|
summary: "Due: Project (Science)",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("dedupes by assessment id", () => {
|
||||||
|
const events = mapAssessmentsToGoogleEvents(
|
||||||
|
ORIGIN,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
title: "A",
|
||||||
|
subject: "X",
|
||||||
|
code: "X",
|
||||||
|
due: "2026-07-01",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
title: "A duplicate",
|
||||||
|
subject: "X",
|
||||||
|
code: "X",
|
||||||
|
due: "2026-07-01",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"UTC",
|
||||||
|
);
|
||||||
|
expect(events).toHaveLength(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
import { toISODate } from "@/seqta/utils/Loaders/engageParentTimetable";
|
||||||
|
import type { GoogleCalendarEventInput } from "./types";
|
||||||
|
|
||||||
|
export interface CalendarSyncAssessment {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
subject: string;
|
||||||
|
code: string;
|
||||||
|
due: string;
|
||||||
|
status?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SKIP_STATUSES = new Set(["MARKS_RELEASED", "CANCELLED"]);
|
||||||
|
|
||||||
|
export function isAssessmentSeqtaKey(seqtaKey: string): boolean {
|
||||||
|
return seqtaKey.includes(":assessment:");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function seqtaAssessmentKey(origin: string, assessmentId: number): string {
|
||||||
|
return `${origin}:assessment:${assessmentId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dueDateOnly(due: string): string | null {
|
||||||
|
const trimmed = due.trim();
|
||||||
|
if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return trimmed;
|
||||||
|
const parsed = new Date(trimmed);
|
||||||
|
if (Number.isNaN(parsed.getTime())) return null;
|
||||||
|
return toISODate(parsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addDays(isoDate: string, days: number): string {
|
||||||
|
const d = new Date(`${isoDate}T12:00:00`);
|
||||||
|
d.setDate(d.getDate() + days);
|
||||||
|
return toISODate(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasTimeComponent(due: string): boolean {
|
||||||
|
const trimmed = due.trim();
|
||||||
|
if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) return false;
|
||||||
|
return /T\d{2}:\d{2}/.test(trimmed) || /\d{1,2}:\d{2}/.test(trimmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
function timedDueBounds(due: string, timeZone: string): { start: string; end: string } | null {
|
||||||
|
const parsed = new Date(due.trim());
|
||||||
|
if (Number.isNaN(parsed.getTime())) return null;
|
||||||
|
const datePart = toISODate(parsed);
|
||||||
|
const pad = (n: number) => String(n).padStart(2, "0");
|
||||||
|
const hours = parsed.getHours();
|
||||||
|
const minutes = parsed.getMinutes();
|
||||||
|
const start = `${datePart}T${pad(hours)}:${pad(minutes)}:00`;
|
||||||
|
const endDate = new Date(parsed);
|
||||||
|
endDate.setMinutes(endDate.getMinutes() + 30);
|
||||||
|
const endDatePart = toISODate(endDate);
|
||||||
|
const end = `${endDatePart}T${pad(endDate.getHours())}:${pad(endDate.getMinutes())}:00`;
|
||||||
|
void timeZone;
|
||||||
|
return { start, end };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function shouldSyncAssessment(assessment: CalendarSyncAssessment): boolean {
|
||||||
|
if (!assessment.id || !assessment.title.trim()) return false;
|
||||||
|
if (assessment.status && SKIP_STATUSES.has(assessment.status)) return false;
|
||||||
|
return dueDateOnly(assessment.due) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function assessmentToGoogleEvent(
|
||||||
|
origin: string,
|
||||||
|
assessment: CalendarSyncAssessment,
|
||||||
|
timeZone: string,
|
||||||
|
): GoogleCalendarEventInput | null {
|
||||||
|
if (!shouldSyncAssessment(assessment)) return null;
|
||||||
|
|
||||||
|
const dateOnly = dueDateOnly(assessment.due)!;
|
||||||
|
const subjectLabel = (assessment.subject || assessment.code || "Assessment").trim();
|
||||||
|
const summary = `Due: ${assessment.title.trim()} (${subjectLabel})`;
|
||||||
|
|
||||||
|
const descriptionLines = ["Synced by BetterSEQTA+", "Type: Assessment due date"];
|
||||||
|
if (assessment.code) descriptionLines.push(`Code: ${assessment.code}`);
|
||||||
|
|
||||||
|
const seqtaKey = seqtaAssessmentKey(origin, assessment.id);
|
||||||
|
|
||||||
|
if (hasTimeComponent(assessment.due)) {
|
||||||
|
const bounds = timedDueBounds(assessment.due, timeZone);
|
||||||
|
if (!bounds) return null;
|
||||||
|
return {
|
||||||
|
seqtaKey,
|
||||||
|
summary,
|
||||||
|
description: descriptionLines.join("\n"),
|
||||||
|
startDateTime: bounds.start,
|
||||||
|
endDateTime: bounds.end,
|
||||||
|
timeZone,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
seqtaKey,
|
||||||
|
summary,
|
||||||
|
description: descriptionLines.join("\n"),
|
||||||
|
allDay: true,
|
||||||
|
startDate: dateOnly,
|
||||||
|
endDate: addDays(dateOnly, 1),
|
||||||
|
startDateTime: `${dateOnly}T00:00:00`,
|
||||||
|
endDateTime: `${dateOnly}T23:59:00`,
|
||||||
|
timeZone,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mapAssessmentsToGoogleEvents(
|
||||||
|
origin: string,
|
||||||
|
assessments: CalendarSyncAssessment[],
|
||||||
|
timeZone: string,
|
||||||
|
): GoogleCalendarEventInput[] {
|
||||||
|
const out: GoogleCalendarEventInput[] = [];
|
||||||
|
const seen = new Set<string>();
|
||||||
|
for (const assessment of assessments) {
|
||||||
|
const mapped = assessmentToGoogleEvent(origin, assessment, timeZone);
|
||||||
|
if (!mapped || seen.has(mapped.seqtaKey)) continue;
|
||||||
|
seen.add(mapped.seqtaKey);
|
||||||
|
out.push(mapped);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
@@ -94,12 +94,21 @@ export function mapLessonsToGoogleEvents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function googleApiEventBody(event: GoogleCalendarEventInput): Record<string, unknown> {
|
export function googleApiEventBody(event: GoogleCalendarEventInput): Record<string, unknown> {
|
||||||
|
const start =
|
||||||
|
event.allDay && event.startDate
|
||||||
|
? { date: event.startDate }
|
||||||
|
: { dateTime: event.startDateTime, timeZone: event.timeZone };
|
||||||
|
const end =
|
||||||
|
event.allDay && event.endDate
|
||||||
|
? { date: event.endDate }
|
||||||
|
: { dateTime: event.endDateTime, timeZone: event.timeZone };
|
||||||
|
|
||||||
const body: Record<string, unknown> = {
|
const body: Record<string, unknown> = {
|
||||||
summary: event.summary,
|
summary: event.summary,
|
||||||
location: event.location,
|
location: event.location,
|
||||||
description: event.description,
|
description: event.description,
|
||||||
start: { dateTime: event.startDateTime, timeZone: event.timeZone },
|
start,
|
||||||
end: { dateTime: event.endDateTime, timeZone: event.timeZone },
|
end,
|
||||||
extendedProperties: {
|
extendedProperties: {
|
||||||
private: {
|
private: {
|
||||||
[BSPLUS_GOOGLE_CALENDAR_EVENT_PROP]: event.seqtaKey,
|
[BSPLUS_GOOGLE_CALENDAR_EVENT_PROP]: event.seqtaKey,
|
||||||
@@ -119,8 +128,13 @@ export function outlookGraphEventBody(event: GoogleCalendarEventInput): Record<s
|
|||||||
contentType: "text",
|
contentType: "text",
|
||||||
content: outlookDescriptionWithKey(event.description, event.seqtaKey),
|
content: outlookDescriptionWithKey(event.description, event.seqtaKey),
|
||||||
},
|
},
|
||||||
start: { dateTime: event.startDateTime, timeZone: event.timeZone },
|
start: event.allDay
|
||||||
end: { dateTime: event.endDateTime, timeZone: event.timeZone },
|
? { dateTime: `${event.startDate}T00:00:00`, timeZone: event.timeZone }
|
||||||
|
: { dateTime: event.startDateTime, timeZone: event.timeZone },
|
||||||
|
end: event.allDay
|
||||||
|
? { dateTime: `${event.endDate}T00:00:00`, timeZone: event.timeZone }
|
||||||
|
: { dateTime: event.endDateTime, timeZone: event.timeZone },
|
||||||
|
isAllDay: Boolean(event.allDay),
|
||||||
categories: [BSPLUS_OUTLOOK_CALENDAR_EVENT_CATEGORY],
|
categories: [BSPLUS_OUTLOOK_CALENDAR_EVENT_CATEGORY],
|
||||||
};
|
};
|
||||||
if (event.location) {
|
if (event.location) {
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import {
|
||||||
|
shouldSyncAssessment,
|
||||||
|
type CalendarSyncAssessment,
|
||||||
|
} from "@/seqta/utils/googleCalendar/assessmentEventMapper";
|
||||||
|
import { resolveStudentId } from "@/seqta/utils/googleCalendar/fetchTimetable";
|
||||||
|
import { isDateInRange, type SyncDateRange } from "@/seqta/utils/googleCalendar/syncDateRange";
|
||||||
|
import { toISODate } from "@/seqta/utils/Loaders/engageParentTimetable";
|
||||||
|
|
||||||
|
async function postSeqtaJson<T>(path: string, body: Record<string, unknown>): Promise<T> {
|
||||||
|
const res = await fetch(`${location.origin}${path}`, {
|
||||||
|
method: "POST",
|
||||||
|
credentials: "include",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
Accept: "text/javascript, text/html, application/xml, text/xml, */*",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`SEQTA request failed (${res.status})`);
|
||||||
|
}
|
||||||
|
return (await res.json()) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEngageParentContext(): boolean {
|
||||||
|
return (
|
||||||
|
location.pathname.includes("/parent/") ||
|
||||||
|
location.hash.includes("/parent/") ||
|
||||||
|
document.body.classList.contains("parent")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeDue(raw: Record<string, unknown>): string {
|
||||||
|
const due = raw.due ?? raw.date ?? raw.dueDate;
|
||||||
|
return typeof due === "string" ? due : String(due ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseAssessmentRow(raw: unknown): CalendarSyncAssessment | null {
|
||||||
|
if (!raw || typeof raw !== "object") return null;
|
||||||
|
const row = raw as Record<string, unknown>;
|
||||||
|
const id = Number(row.id);
|
||||||
|
const title = String(row.title ?? "").trim();
|
||||||
|
const due = normalizeDue(row);
|
||||||
|
if (!id || !title || !due) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
title,
|
||||||
|
subject: String(row.subject ?? row.code ?? "").trim(),
|
||||||
|
code: String(row.code ?? row.subject ?? "").trim(),
|
||||||
|
due,
|
||||||
|
status: row.status != null ? String(row.status) : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function dueDateInRange(due: string, range: SyncDateRange): boolean {
|
||||||
|
const trimmed = due.trim();
|
||||||
|
let datePart = trimmed;
|
||||||
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
|
||||||
|
const parsed = new Date(trimmed);
|
||||||
|
if (Number.isNaN(parsed.getTime())) return false;
|
||||||
|
datePart = toISODate(parsed);
|
||||||
|
}
|
||||||
|
return isDateInRange(datePart, range);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchUpcomingAssessments(studentId: number): Promise<CalendarSyncAssessment[]> {
|
||||||
|
const path = isEngageParentContext()
|
||||||
|
? "/seqta/parent/assessment/list/upcoming?"
|
||||||
|
: "/seqta/student/assessment/list/upcoming?";
|
||||||
|
const data = await postSeqtaJson<{ payload?: unknown[] }>(path, { student: studentId });
|
||||||
|
const payload = Array.isArray(data.payload) ? data.payload : [];
|
||||||
|
const out: CalendarSyncAssessment[] = [];
|
||||||
|
for (const raw of payload) {
|
||||||
|
const parsed = parseAssessmentRow(raw);
|
||||||
|
if (parsed) out.push(parsed);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Upcoming assessments with due dates inside the sync window. */
|
||||||
|
export async function fetchAssessmentsForCalendarSync(
|
||||||
|
range: SyncDateRange,
|
||||||
|
): Promise<CalendarSyncAssessment[]> {
|
||||||
|
try {
|
||||||
|
const studentId = await resolveStudentId();
|
||||||
|
if (studentId == null) return [];
|
||||||
|
|
||||||
|
const upcoming = await fetchUpcomingAssessments(studentId);
|
||||||
|
return upcoming.filter(
|
||||||
|
(a) => shouldSyncAssessment(a) && dueDateInRange(a.due, range),
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn("[BetterSEQTA+] Assessment calendar fetch failed:", err);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { CalendarSyncAssessment } from "./assessmentEventMapper";
|
||||||
|
|
||||||
export interface SeqtaTimetableLesson {
|
export interface SeqtaTimetableLesson {
|
||||||
date: string;
|
date: string;
|
||||||
from: string;
|
from: string;
|
||||||
@@ -25,11 +27,18 @@ export interface GoogleCalendarEventInput {
|
|||||||
timeZone: string;
|
timeZone: string;
|
||||||
/** Google Calendar event colorId ("1"–"11"). */
|
/** Google Calendar event colorId ("1"–"11"). */
|
||||||
colorId?: string;
|
colorId?: string;
|
||||||
|
/** All-day events (assessment due dates without a time). */
|
||||||
|
allDay?: boolean;
|
||||||
|
startDate?: string;
|
||||||
|
/** Exclusive end date for all-day events (Google Calendar convention). */
|
||||||
|
endDate?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GoogleCalendarSyncRequest {
|
export interface GoogleCalendarSyncRequest {
|
||||||
origin: string;
|
origin: string;
|
||||||
lessons: SeqtaTimetableLesson[];
|
lessons: SeqtaTimetableLesson[];
|
||||||
|
assessments?: CalendarSyncAssessment[];
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
mode?: "full" | "incremental";
|
mode?: "full" | "incremental";
|
||||||
weeksAhead?: number;
|
weeksAhead?: number;
|
||||||
}
|
}
|
||||||
@@ -68,6 +77,7 @@ export interface GoogleCalendarStatus {
|
|||||||
lastSyncOrigin?: string;
|
lastSyncOrigin?: string;
|
||||||
syncWeeksAhead?: number;
|
syncWeeksAhead?: number;
|
||||||
autoSyncWeekly?: boolean;
|
autoSyncWeekly?: boolean;
|
||||||
|
syncAssessmentDueDates?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GoogleCalendarDeleteResult {
|
export interface GoogleCalendarDeleteResult {
|
||||||
|
|||||||
Reference in new issue
Block a user