mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: update job title
This commit is contained in:
@@ -50,6 +50,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dark .switch[data-ison="true"] {
|
.dark .switch[data-ison="true"] {
|
||||||
@apply from-[#30D259]/50 to-[#30D259];
|
@apply from-[#30D259]/40 to-[#30D259];
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { Job } from "./types";
|
import type { Job } from "./types";
|
||||||
import { messagesJob } from "./jobs/messages";
|
import { messagesJob } from "./jobs/messages";
|
||||||
import { assessmentsJob } from "./jobs/assessments";
|
import { notificationsJob } from "./jobs/notifications";
|
||||||
import { forumsJob } from "./jobs/forums";
|
import { forumsJob } from "./jobs/forums";
|
||||||
|
|
||||||
export const jobs: Record<string, Job> = {
|
export const jobs: Record<string, Job> = {
|
||||||
messages: messagesJob,
|
messages: messagesJob,
|
||||||
assessments: assessmentsJob,
|
notifications: notificationsJob,
|
||||||
forums: forumsJob,
|
forums: forumsJob,
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-9
@@ -27,8 +27,7 @@ interface AssessmentNotification {
|
|||||||
|
|
||||||
type Notification = MessageNotification | AssessmentNotification;
|
type Notification = MessageNotification | AssessmentNotification;
|
||||||
|
|
||||||
/* ------------- Progress model ------------- */
|
interface NotificationsProgress {
|
||||||
interface AssessmentsProgress {
|
|
||||||
lastTs: number; // ms since epoch of last processed notification
|
lastTs: number; // ms since epoch of last processed notification
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,14 +107,14 @@ const fetchAssessmentName = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* ------------- Job ------------- */
|
/* ------------- Job ------------- */
|
||||||
export const assessmentsJob: Job = {
|
export const notificationsJob: Job = {
|
||||||
id: "assessments",
|
id: "notifications",
|
||||||
label: "Assessments",
|
label: "Notifications",
|
||||||
renderComponentId: "assessment",
|
renderComponentId: "notifications",
|
||||||
frequency: { type: "expiry", afterMs: 15 * 60 * 1000 },
|
frequency: { type: "expiry", afterMs: 15 * 60 * 1000 },
|
||||||
|
|
||||||
run: async (ctx) => {
|
run: async (ctx) => {
|
||||||
const progress = (await ctx.getProgress<AssessmentsProgress>()) ?? {
|
const progress = (await ctx.getProgress<NotificationsProgress>()) ?? {
|
||||||
lastTs: 0,
|
lastTs: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -123,14 +122,14 @@ export const assessmentsJob: Job = {
|
|||||||
try {
|
try {
|
||||||
notifications = await fetchNotifications();
|
notifications = await fetchNotifications();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("[Assessments job] fetch failed:", e);
|
console.error("[Notifications job] fetch failed:", e);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const notificationIsIndexed = async (id: string): Promise<boolean> => {
|
const notificationIsIndexed = async (id: string): Promise<boolean> => {
|
||||||
const [inAssessments, inMessages] = await Promise.all([
|
const [inAssessments, inMessages] = await Promise.all([
|
||||||
ctx
|
ctx
|
||||||
.getStoredItems("assessments")
|
.getStoredItems("notifications")
|
||||||
.then((items) => items.some((i) => i.id === id)),
|
.then((items) => items.some((i) => i.id === id)),
|
||||||
ctx
|
ctx
|
||||||
.getStoredItems("messages")
|
.getStoredItems("messages")
|
||||||
Reference in New Issue
Block a user