This commit is contained in:
+4
-5
@@ -39,7 +39,7 @@ interface ResolvedDay {
|
||||
/**
|
||||
* Read theme colors from the workbook
|
||||
*/
|
||||
async function getThemeColors(filePath: string): Promise<ThemeColors | null> {
|
||||
export async function getThemeColors(filePath: string): Promise<ThemeColors | null> {
|
||||
const data = fs.readFileSync(filePath);
|
||||
const zip = await JSZip.loadAsync(data);
|
||||
|
||||
@@ -164,10 +164,9 @@ export default async function parseV3(workbook: Workbook, downloadedFilePath: st
|
||||
// ────────────────────────────────────────────────────────────
|
||||
//
|
||||
|
||||
function getUpcomingSheets(workbook: ExcelJS.Workbook): ResolvedDay[] {
|
||||
export function getUpcomingSheets(workbook: ExcelJS.Workbook, today: Date = new Date()): ResolvedDay[] {
|
||||
const dateRegex = /^(pondělí|úterý|středa|čtvrtek|pátek|po|út|ut|st|čt|ct|pa|pá)\s+(\d{1,2})\.+\s*(\d{1,2})\.+\s*(\d{4}|\d{2})/i;
|
||||
|
||||
const today = new Date();
|
||||
const todayMidnight = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
|
||||
const result: ResolvedDay[] = [];
|
||||
@@ -190,7 +189,7 @@ function getUpcomingSheets(workbook: ExcelJS.Workbook): ResolvedDay[] {
|
||||
return result;
|
||||
}
|
||||
|
||||
function groupSheetsByDate(items: ResolvedDay[]) {
|
||||
export function groupSheetsByDate(items: ResolvedDay[]) {
|
||||
const map: Record<string, Worksheet[]> = {};
|
||||
|
||||
for (const item of items) {
|
||||
@@ -214,7 +213,7 @@ function groupSheetsByDate(items: ResolvedDay[]) {
|
||||
// ────────────────────────────────────────────────────────────
|
||||
//
|
||||
|
||||
function extractDaySchedule(sheet: Worksheet, teacherMap: Record<string, string>, themeColors: ThemeColors | null, flags: Flag[]) {
|
||||
export function extractDaySchedule(sheet: Worksheet, teacherMap: Record<string, string>, themeColors: ThemeColors | null, flags: Flag[]) {
|
||||
return {
|
||||
changes: extractClassChanges(sheet, themeColors, flags),
|
||||
absence: extractAbsence(sheet, teacherMap),
|
||||
|
||||
Reference in New Issue
Block a user