From b6714ffe7c0e2ea26fa6cd992c78e6cbc52dace4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 12:44:19 +0000 Subject: [PATCH 1/4] Add month header row to attendance report Shows which month each day column belongs to when report spans multiple months, via a merged month-name cell above the day-of-week row. --- server/src/reports/klassAttendanceReport.ts | 61 +++++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/server/src/reports/klassAttendanceReport.ts b/server/src/reports/klassAttendanceReport.ts index 3d11c9fa..12c6968d 100644 --- a/server/src/reports/klassAttendanceReport.ts +++ b/server/src/reports/klassAttendanceReport.ts @@ -321,10 +321,29 @@ const BUILDING = { // separatorRow ]; - // Convert header rows to special fields with styling const specialFields: ISpecialField[] = []; + + // Month row: one merged cell per month, spanning that month's day columns + const monthRowIndex = ROW_COUNT.HEADER_OFFSET; + specialFields.push({ + cell: { r: monthRowIndex, c: 0 }, + value: 'חודש', + style: STYLING.tableHeaderStyle, + }); + FORMATTING.getMonthSpans(sessions).forEach(({ startCol, endCol, label }) => { + specialFields.push({ + cell: { r: monthRowIndex, c: startCol }, + value: label, + style: STYLING.tableHeaderStyle, + ...(endCol > startCol + ? { merge: { s: { r: monthRowIndex, c: startCol }, e: { r: monthRowIndex, c: endCol } } } + : {}), + }); + }); + + // Convert remaining header rows to special fields with styling rows.forEach((row, rowIndex) => { - const actualRowIndex = ROW_COUNT.HEADER_OFFSET + rowIndex; + const actualRowIndex = monthRowIndex + 1 + rowIndex; row.forEach((cell, colIndex) => { if (cell !== '') { specialFields.push({ @@ -336,10 +355,11 @@ const BUILDING = { }); }); - // Define borders for header section + // Define borders for header section (month row + rows above) + const rowCount = 1 + rows.length; const lastCol = sessions.length; const startRow = ROW_INDEX.TABLE_START; - const endRow = startRow + rows.length - 1; + const endRow = startRow + rowCount - 1; const borderRanges = [ { @@ -349,7 +369,7 @@ const BUILDING = { }, ]; - return { rowCount: rows.length, specialFields, borderRanges }; + return { rowCount, specialFields, borderRanges }; }, // Build table data section: student rows + special fields + borders @@ -559,12 +579,43 @@ const BUILDING = { }, }; +const HEBREW_MONTHS = [ + 'ינואר', + 'פברואר', + 'מרץ', + 'אפריל', + 'מאי', + 'יוני', + 'יולי', + 'אוגוסט', + 'ספטמבר', + 'אוקטובר', + 'נובמבר', + 'דצמבר', +]; + const FORMATTING = { getHebrewDayOfWeek(date: Date): string { const days = ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש']; return days[date.getDay()]; }, + // Group session columns into consecutive same-month spans (1-based column index, col 0 is the label column) + getMonthSpans(sessions: SessionData[]): { startCol: number; endCol: number; label: string }[] { + const spans: { startCol: number; endCol: number; label: string }[] = []; + sessions.forEach((session, index) => { + const col = index + 1; + const label = `${HEBREW_MONTHS[session.date.getMonth()]} ${session.date.getFullYear()}`; + const last = spans[spans.length - 1]; + if (last && last.label === label) { + last.endCol = col; + } else { + spans.push({ startCol: col, endCol: col, label }); + } + }); + return spans; + }, + getAttendanceMark(reports: (AttReport | null | undefined)[]): string { const existingReports = reports.filter(Boolean) as AttReport[]; if (!existingReports.length) return '--'; // No report for this session/day From 762549ea58cdf820b78887e7ddd6c5f3b24938fb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 19:28:04 +0000 Subject: [PATCH 2/4] Show day/month in attendance report date row instead of month header Simpler fix: date cell reads e.g. 1/6 instead of just 1, so every day is unambiguous when the report spans multiple months. --- server/src/reports/klassAttendanceReport.ts | 63 ++------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/server/src/reports/klassAttendanceReport.ts b/server/src/reports/klassAttendanceReport.ts index 12c6968d..1409c23c 100644 --- a/server/src/reports/klassAttendanceReport.ts +++ b/server/src/reports/klassAttendanceReport.ts @@ -304,7 +304,7 @@ const BUILDING = { // Build table header section: rows + special fields + borders buildTableHeaderSection(sessions: SessionData[]) { const dayRow = ['יום בשבוע', ...sessions.map((s) => s.dayOfWeek)]; - const dateRow = ['תאריך', ...sessions.map((s) => s.date.getDate().toString())]; + const dateRow = ['תאריך', ...sessions.map((s) => `${s.date.getDate()}/${s.date.getMonth() + 1}`)]; // const hoursRow = ['שעות לימוד', ...sessions.map(s => `${formatTime(s.startTime)}-${formatTime(s.endTime)}`)]; // const topicRow = ['שיעור', ...sessions.map(s => s.topic)]; // const lessonCountRow = ['מס\' שעות לימוד', ...sessions.map(s => s.lessonCount.toString())]; @@ -321,29 +321,10 @@ const BUILDING = { // separatorRow ]; + // Convert header rows to special fields with styling const specialFields: ISpecialField[] = []; - - // Month row: one merged cell per month, spanning that month's day columns - const monthRowIndex = ROW_COUNT.HEADER_OFFSET; - specialFields.push({ - cell: { r: monthRowIndex, c: 0 }, - value: 'חודש', - style: STYLING.tableHeaderStyle, - }); - FORMATTING.getMonthSpans(sessions).forEach(({ startCol, endCol, label }) => { - specialFields.push({ - cell: { r: monthRowIndex, c: startCol }, - value: label, - style: STYLING.tableHeaderStyle, - ...(endCol > startCol - ? { merge: { s: { r: monthRowIndex, c: startCol }, e: { r: monthRowIndex, c: endCol } } } - : {}), - }); - }); - - // Convert remaining header rows to special fields with styling rows.forEach((row, rowIndex) => { - const actualRowIndex = monthRowIndex + 1 + rowIndex; + const actualRowIndex = ROW_COUNT.HEADER_OFFSET + rowIndex; row.forEach((cell, colIndex) => { if (cell !== '') { specialFields.push({ @@ -355,11 +336,10 @@ const BUILDING = { }); }); - // Define borders for header section (month row + rows above) - const rowCount = 1 + rows.length; + // Define borders for header section const lastCol = sessions.length; const startRow = ROW_INDEX.TABLE_START; - const endRow = startRow + rowCount - 1; + const endRow = startRow + rows.length - 1; const borderRanges = [ { @@ -369,7 +349,7 @@ const BUILDING = { }, ]; - return { rowCount, specialFields, borderRanges }; + return { rowCount: rows.length, specialFields, borderRanges }; }, // Build table data section: student rows + special fields + borders @@ -579,43 +559,12 @@ const BUILDING = { }, }; -const HEBREW_MONTHS = [ - 'ינואר', - 'פברואר', - 'מרץ', - 'אפריל', - 'מאי', - 'יוני', - 'יולי', - 'אוגוסט', - 'ספטמבר', - 'אוקטובר', - 'נובמבר', - 'דצמבר', -]; - const FORMATTING = { getHebrewDayOfWeek(date: Date): string { const days = ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש']; return days[date.getDay()]; }, - // Group session columns into consecutive same-month spans (1-based column index, col 0 is the label column) - getMonthSpans(sessions: SessionData[]): { startCol: number; endCol: number; label: string }[] { - const spans: { startCol: number; endCol: number; label: string }[] = []; - sessions.forEach((session, index) => { - const col = index + 1; - const label = `${HEBREW_MONTHS[session.date.getMonth()]} ${session.date.getFullYear()}`; - const last = spans[spans.length - 1]; - if (last && last.label === label) { - last.endCol = col; - } else { - spans.push({ startCol: col, endCol: col, label }); - } - }); - return spans; - }, - getAttendanceMark(reports: (AttReport | null | undefined)[]): string { const existingReports = reports.filter(Boolean) as AttReport[]; if (!existingReports.length) return '--'; // No report for this session/day From b0c8999790a04d9906bdf26cce20b4fe8c992ec0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 19:28:55 +0000 Subject: [PATCH 3/4] Format attendance report date cell as DD-MM --- server/src/reports/klassAttendanceReport.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/reports/klassAttendanceReport.ts b/server/src/reports/klassAttendanceReport.ts index 1409c23c..fceeb668 100644 --- a/server/src/reports/klassAttendanceReport.ts +++ b/server/src/reports/klassAttendanceReport.ts @@ -304,7 +304,12 @@ const BUILDING = { // Build table header section: rows + special fields + borders buildTableHeaderSection(sessions: SessionData[]) { const dayRow = ['יום בשבוע', ...sessions.map((s) => s.dayOfWeek)]; - const dateRow = ['תאריך', ...sessions.map((s) => `${s.date.getDate()}/${s.date.getMonth() + 1}`)]; + const dateRow = [ + 'תאריך', + ...sessions.map( + (s) => `${s.date.getDate().toString().padStart(2, '0')}-${(s.date.getMonth() + 1).toString().padStart(2, '0')}`, + ), + ]; // const hoursRow = ['שעות לימוד', ...sessions.map(s => `${formatTime(s.startTime)}-${formatTime(s.endTime)}`)]; // const topicRow = ['שיעור', ...sessions.map(s => s.topic)]; // const lessonCountRow = ['מס\' שעות לימוד', ...sessions.map(s => s.lessonCount.toString())]; From 7c8b9c144a4a04ed8b24ef3d31e0be6e793a9da3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 19:29:26 +0000 Subject: [PATCH 4/4] Use slash separator (DD/MM) in attendance report date cell --- server/src/reports/klassAttendanceReport.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/reports/klassAttendanceReport.ts b/server/src/reports/klassAttendanceReport.ts index fceeb668..56978c73 100644 --- a/server/src/reports/klassAttendanceReport.ts +++ b/server/src/reports/klassAttendanceReport.ts @@ -307,7 +307,7 @@ const BUILDING = { const dateRow = [ 'תאריך', ...sessions.map( - (s) => `${s.date.getDate().toString().padStart(2, '0')}-${(s.date.getMonth() + 1).toString().padStart(2, '0')}`, + (s) => `${s.date.getDate().toString().padStart(2, '0')}/${(s.date.getMonth() + 1).toString().padStart(2, '0')}`, ), ]; // const hoursRow = ['שעות לימוד', ...sessions.map(s => `${formatTime(s.startTime)}-${formatTime(s.endTime)}`)];