From 048fbc4d5cce06b2d86d226288c073adea0a8548 Mon Sep 17 00:00:00 2001 From: HadasaSchechterV <100204928+HadasaSchechterV@users.noreply.github.com> Date: Sun, 5 Jul 2026 22:54:34 +0300 Subject: [PATCH] feat: add gradesLessThan filter to student report card Mirrors the existing attendanceLessThan filter to let a report show only rows with a grade below a given threshold. Co-Authored-By: Claude Sonnet 5 --- client/src/reports/studentReportCardReactButton.jsx | 5 +++++ client/src/roadmapFeatures.js | 1 + server/src/reports/reportGenerator.ts | 13 +++++++------ server/src/reports/studentReportCardReact.tsx | 4 ++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/client/src/reports/studentReportCardReactButton.jsx b/client/src/reports/studentReportCardReactButton.jsx index 2d28c5f5..620e0d72 100644 --- a/client/src/reports/studentReportCardReactButton.jsx +++ b/client/src/reports/studentReportCardReactButton.jsx @@ -40,6 +40,11 @@ export default ({ defaultRequestValues }) => { + ); }; diff --git a/client/src/roadmapFeatures.js b/client/src/roadmapFeatures.js index e2229699..505444fe 100644 --- a/client/src/roadmapFeatures.js +++ b/client/src/roadmapFeatures.js @@ -18,6 +18,7 @@ export default [ { html: 'הוספת סינון לפי תאריכים בתעודה', status: 'בוצע', statusColor: 'success' }, { html: 'מילוי אוטומטי של קבצי מכלול', status: 'בוצע', statusColor: 'success' }, { html: 'הצגת ציון אחרון במקום ממוצע', status: 'בוצע', statusColor: 'success' }, + { html: 'הוספת סינון לפי ציון נמוך מ בתעודה', status: 'בוצע', statusColor: 'success' }, // { html: 'הגדרת תקופת זמן לפי תאריכים', status: 'בקרוב', statusColor: 'warning' }, // { html: 'הגדרת תקופת זמן לפי יום בשבוע', status: 'בוצע', statusColor: 'success' }, diff --git a/server/src/reports/reportGenerator.ts b/server/src/reports/reportGenerator.ts index 29f7958d..b389e19a 100644 --- a/server/src/reports/reportGenerator.ts +++ b/server/src/reports/reportGenerator.ts @@ -31,7 +31,8 @@ export function generateStudentReportCard(userId: any, reqExtra: any, generator: downComment: getAsBoolean(reqExtra.downComment), lastGrade: getAsBoolean(reqExtra.lastGrade), debug: getAsBoolean(reqExtra.debug), - attendanceLessThan: getAttPercentLessThanParam(reqExtra.attendanceLessThan), + attendanceLessThan: getPercentLessThanParam(reqExtra.attendanceLessThan), + gradesLessThan: getPercentLessThanParam(reqExtra.gradesLessThan), }; console.log('student report card extra params: ', extraParams); const params = getAsArray(reqExtra.ids)?.map((id) => ({ @@ -45,11 +46,11 @@ export function generateStudentReportCard(userId: any, reqExtra: any, generator: }; } -function getAttPercentLessThanParam(attendanceLessThanStr: string): number { - if (attendanceLessThanStr) { - const attLessThanNum = parseInt(attendanceLessThanStr); - if (!isNaN(attLessThanNum)) { - return attLessThanNum / 100; +function getPercentLessThanParam(lessThanStr: string): number { + if (lessThanStr) { + const lessThanNum = parseInt(lessThanStr); + if (!isNaN(lessThanNum)) { + return lessThanNum / 100; } } return undefined; diff --git a/server/src/reports/studentReportCardReact.tsx b/server/src/reports/studentReportCardReact.tsx index f07a0207..83caccdf 100644 --- a/server/src/reports/studentReportCardReact.tsx +++ b/server/src/reports/studentReportCardReact.tsx @@ -498,6 +498,7 @@ export interface IReportParams { lastGrade?: boolean; debug?: boolean; attendanceLessThan?: number; + gradesLessThan?: number; } export const getReportData: IGetReportDataFunction = async (params, dataSource) => { const reportDate = getReportDateFilter(dateFromString(params.startDate), dateFromString(params.endDate)); @@ -615,6 +616,9 @@ function filterReports(reports: IExtenedStudentPercentReport[], reportParams: IR if (reportParams.attendanceLessThan && (report.attPercents >= reportParams.attendanceLessThan)) { return false; } + if (reportParams.gradesLessThan && (report.gradeAvg >= reportParams.gradesLessThan)) { + return false; + } return !( (reportParams.forceGrades && (report.gradeAvg === undefined || report.gradeAvg === null)) || (reportParams.forceAtt && !report.lessonsCount)