Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/src/reports/studentReportCardReactButton.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TextInput, DateInput, NumberInput } from 'react-admin';
import { TextInput, DateInput, NumberInput, BooleanInput } from 'react-admin';
import { defaultYearFilter } from '@shared/utils/yearFilter';
import { CommonYearInput } from '@shared/components/fields/CommonYear';
import NoteAltIcon from '@mui/icons-material/NoteAlt';
Expand Down Expand Up @@ -45,6 +45,10 @@ export default ({ defaultRequestValues }) => {
label="הצג רק שורות עם ציון נמוך מ (%)"
helperText="הסינון מתבצע לפי הציון המקורי, לפני התאמה לפי אחוזי נוכחות"
/>
<BooleanInput
source="limitFilterUseOr"
label="כאשר שני הסינונים הקודמים מלאים, הצג שורה כשמתקיים לפחות אחד מהם (במקום שניהם יחד)"
/>
</BulkReportButton>
);
};
1 change: 1 addition & 0 deletions client/src/roadmapFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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' },
Expand Down
1 change: 1 addition & 0 deletions server/src/reports/reportGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function generateStudentReportCard(userId: any, reqExtra: any, generator:
debug: getAsBoolean(reqExtra.debug),
attendanceLessThan: getPercentLessThanParam(reqExtra.attendanceLessThan),
gradesLessThan: getPercentLessThanParam(reqExtra.gradesLessThan),
limitFilterUseOr: getAsBoolean(reqExtra.limitFilterUseOr),
};
console.log('student report card extra params: ', extraParams);
const params = getAsArray(reqExtra.ids)?.map((id) => ({
Expand Down
17 changes: 13 additions & 4 deletions server/src/reports/studentReportCardReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export interface IReportParams {
debug?: boolean;
attendanceLessThan?: number;
gradesLessThan?: number;
limitFilterUseOr?: boolean;
}
export const getReportData: IGetReportDataFunction<IReportParams, AppProps> = async (params, dataSource) => {
const reportDate = getReportDateFilter(dateFromString(params.startDate), dateFromString(params.endDate));
Expand Down Expand Up @@ -613,12 +614,20 @@ function getReports(

function filterReports(reports: IExtenedStudentPercentReport[], reportParams: IReportParams): AppProps['reports'][number]['reports'] {
return reports.filter(report => {
if (reportParams.attendanceLessThan && (report.attPercents >= reportParams.attendanceLessThan)) {
return false;
}
if (reportParams.gradesLessThan && (report.gradeAvg >= reportParams.gradesLessThan)) {
const failsAttendanceLimit = reportParams.attendanceLessThan && report.attPercents >= reportParams.attendanceLessThan;
const failsGradesLimit = reportParams.gradesLessThan && report.gradeAvg >= reportParams.gradesLessThan;

if (reportParams.attendanceLessThan && reportParams.gradesLessThan) {
const passesLimits = reportParams.limitFilterUseOr
? !failsAttendanceLimit || !failsGradesLimit
: !failsAttendanceLimit && !failsGradesLimit;
if (!passesLimits) {
return false;
}
} else if (failsAttendanceLimit || failsGradesLimit) {
return false;
}
Comment on lines +617 to 629

return !(
(reportParams.forceGrades && (report.gradeAvg === undefined || report.gradeAvg === null)) ||
(reportParams.forceAtt && !report.lessonsCount)
Expand Down
Loading