@@ -2,7 +2,7 @@ const API_BASE_URL = process.env.ANNOUNCEMENT_API || "http://localhost:3000";
|
||||
|
||||
export type Announcement = {
|
||||
id: number;
|
||||
text_content: string;
|
||||
text_content?: string;
|
||||
author: string;
|
||||
flags: Flag[];
|
||||
start_date: string;
|
||||
+5
-4
@@ -18,7 +18,7 @@ import parseTeachers from "../utils/parseTeachers.js"
|
||||
import ExcelJS, { Worksheet, Cell, Row, Workbook } from "exceljs"
|
||||
import JSZip from "jszip";
|
||||
import { parseStringPromise } from "xml2js";
|
||||
import getAnnouncements, { Flag } from "../api/annoucements.js";
|
||||
import getAnnouncements, { Flag } from "../api/announcements.js";
|
||||
|
||||
interface ThemeColors {
|
||||
[key: number]: string | null;
|
||||
@@ -130,12 +130,12 @@ export default async function parseV3(workbook: Workbook, downloadedFilePath: st
|
||||
if (new Date().getDay() === 0) {
|
||||
announcementDates.push(...getWeekDates(7));
|
||||
}
|
||||
const annoucements = await getAnnouncements([...new Set(announcementDates)]);
|
||||
const announcements = await getAnnouncements([...new Set(announcementDates)]);
|
||||
|
||||
const schedule: any = {};
|
||||
|
||||
for (const { dateKey, sheet } of resolvedDays) {
|
||||
const ann = annoucements[dateKey];
|
||||
const ann = announcements[dateKey];
|
||||
const allFlags = ann.map(a => a.flags).flat();
|
||||
|
||||
const { changes, absence, inWork, takesPlace, reservedRooms } = extractDaySchedule(sheet, teacherMap, themeColors, allFlags);
|
||||
@@ -151,7 +151,7 @@ export default async function parseV3(workbook: Workbook, downloadedFilePath: st
|
||||
|
||||
const data = {
|
||||
status: { lastUpdated: formatNowTime() },
|
||||
annoucements,
|
||||
announcements,
|
||||
schedule,
|
||||
};
|
||||
|
||||
@@ -239,6 +239,7 @@ function isPripravaSheet(name: string) {
|
||||
//
|
||||
|
||||
function extractClassChanges(sheet: Worksheet, themeColors: ThemeColors | null, flags: Flag[]) {
|
||||
console.log(flags)
|
||||
const ignoreColors = flags.includes(Flag.SHOW_ALL_ENTRIES)
|
||||
const classRegex = /[AEC][0-4][a-c]?\s*\/.*/s;
|
||||
const prefixRegex = /[AEC][0-4][a-c]?/;
|
||||
|
||||
Reference in New Issue
Block a user