diff --git a/client/src/components/ApprovedAbsencesUpload/useFileProcessor.js b/client/src/components/ApprovedAbsencesUpload/useFileProcessor.js index be365861..e55588c5 100644 --- a/client/src/components/ApprovedAbsencesUpload/useFileProcessor.js +++ b/client/src/components/ApprovedAbsencesUpload/useFileProcessor.js @@ -101,7 +101,6 @@ export const useFileProcessor = (setFileName, setPreviewData, setLoading) => { const matched = matchResults.filter((r) => r.matched).length; const notMatched = matchResults.filter((r) => !r.matched).length; - console.log('Match Results:', matchResults); setPreviewData({ total: validRows.length, matched, diff --git a/client/src/entities/student-percent-report.jsx b/client/src/entities/student-percent-report.jsx index f96e13b2..5a189daa 100644 --- a/client/src/entities/student-percent-report.jsx +++ b/client/src/entities/student-percent-report.jsx @@ -1,4 +1,4 @@ -import { DateInput, NumberField, TextField, ReferenceField, useRecordContext, TextInput } from 'react-admin'; +import { NumberField, TextField, ReferenceField, useRecordContext, TextInput } from 'react-admin'; import { CommonDatagrid } from '@shared/components/crudContainers/CommonList'; import { MultiReferenceField } from '@shared/components/fields/CommonReferenceField'; import { getResourceComponents } from '@shared/components/crudContainers/CommonEntity'; @@ -14,8 +14,6 @@ import { adminUserFilter } from '@shared/components/fields/PermissionFilter'; const filters = [ adminUserFilter, - // , - // , Student, { createForeignKeyConstraints: false }) - // @JoinColumn({ name: 'id' }) - // student: Student; } diff --git a/server/src/entity-modules/att-report-with-report-month.config.ts b/server/src/entity-modules/att-report-with-report-month.config.ts index 20a0bf8a..40307e42 100644 --- a/server/src/entity-modules/att-report-with-report-month.config.ts +++ b/server/src/entity-modules/att-report-with-report-month.config.ts @@ -59,8 +59,6 @@ function getConfig(): BaseEntityModuleOptions { { value: getHebrewDateFormatter('reportDate'), label: 'תאריך עברי' }, { value: 'howManyLessons', label: 'מספר שיעורים' }, { value: 'absCount', label: 'מספר חיסורים' }, - // { value: 'approvedAbsCount', label: 'מספר חיסורים מאושרים' }, - // { value: 'sheetName', label: 'חודש דיווח' }, { value: 'comments', label: 'הערות' }, ]; if (!shouldShowTopic(req)) { @@ -108,7 +106,7 @@ class AttReportWithReportMonthService): Promise { - const attReportService = new BaseEntityService(this.dataSource.getRepository(AttReport), this.mailSendService); + const attReportService = this.getAttReportService(); return attReportService.deleteOne(req) as Promise; } diff --git a/server/src/entity-modules/student-by-year.config.ts b/server/src/entity-modules/student-by-year.config.ts index d48ab7f6..d3f53c0f 100644 --- a/server/src/entity-modules/student-by-year.config.ts +++ b/server/src/entity-modules/student-by-year.config.ts @@ -12,7 +12,7 @@ import { Klass } from 'src/db/entities/Klass.entity'; import { formatPercent } from '@shared/utils/formatting/formatter.util'; import { roundAllNumericProperties } from '@shared/utils/reportData.util'; import { getAsNumberArray } from '@shared/utils/queryParam.util'; -import { ABSENCE_THRESHOLDS } from 'src/utils/absenceThresholds'; +import { ABSENCE_THRESHOLDS, AbsenceThreshold } from 'src/utils/absenceThresholds'; function getConfig(): BaseEntityModuleOptions { return { @@ -197,7 +197,10 @@ class StudentByYearService extends BaseEntityS }), ]); - const headers: Record = {}; + const headers: Record< + string, + { value: string; label: string; numFmt?: string; thresholds?: readonly AbsenceThreshold[] } + > = {}; const rawAbs: Record> = {}; const rawLessons: Record> = {}; const rawKnownAbs: Record> = {}; diff --git a/server/src/entity-modules/student-percent-report.config.ts b/server/src/entity-modules/student-percent-report.config.ts index 46d72eb6..aacf7f3d 100644 --- a/server/src/entity-modules/student-percent-report.config.ts +++ b/server/src/entity-modules/student-percent-report.config.ts @@ -22,7 +22,7 @@ import { IGradeEffect, } from 'src/utils/studentReportData.util'; import { getKnownAbsenceFilterBySprAndDates, getReportDataFilterBySprAndDates } from 'src/utils/studentReportData.util'; -import { DataSource, In } from 'typeorm'; +import { DataSource, EntityTarget, FindOptionsWhere, In } from 'typeorm'; function getConfig(): BaseEntityModuleOptions { return { @@ -67,6 +67,13 @@ function getConfig(): BaseEntityModuleOptions { }; } +interface IStudentPercentReportDebug { + absCountEffectId: string; + gradeEffectId: string; + absCountEffect: IGradeEffect; + gradeEffect: IGradeEffect; +} + interface StudentPercentReportWithDates extends StudentPercentReport { approvedAbsCount?: number; attGradeEffect?: number; @@ -74,7 +81,7 @@ interface StudentPercentReportWithDates extends StudentPercentReport { finalAttendance?: string; estimation?: string; comments?: string; - debug?: any; + debug?: IStudentPercentReportDebug; } class StudentPercentReportService extends BaseEntityService { protected async populatePivotData(pivotName: string, list: T[], extra: any, filter: any, auth: any) { @@ -205,9 +212,15 @@ function getGradeEffectId(item: StudentPercentReportWithDates): string { return `${item.userId}_${Math.floor(item.attPercents * 100)}`; } -function fetchAttGradeEffect( +interface IEffectViewRow { + id: string; + effect: number; + effectPercent: number; +} + +function fetchAttGradeEffect( dataSource: DataSource, - viewEntity: any, + viewEntity: EntityTarget, ids: string[], ): Promise> { return dataSource @@ -215,7 +228,7 @@ function fetchAttGradeEffect( .find({ where: { id: In(ids), - }, + } as FindOptionsWhere, select: ['id', 'effect', 'effectPercent'], }) .then((arr) => diff --git a/server/src/reports/__tests__/michlolPopulatedFile.spec.ts b/server/src/reports/__tests__/michlolPopulatedFile.spec.ts index 7e559261..9e1340d0 100644 --- a/server/src/reports/__tests__/michlolPopulatedFile.spec.ts +++ b/server/src/reports/__tests__/michlolPopulatedFile.spec.ts @@ -5,7 +5,7 @@ import { Student } from 'src/db/entities/Student.entity'; import { AttReportAndGrade } from 'src/db/view-entities/AttReportAndGrade.entity'; import { KnownAbsence } from 'src/db/entities/KnownAbsence.entity'; import { AttGradeEffect } from 'src/db/entities/AttGradeEffect'; -import michlolPopulatedFile, { MichlolPopulatedFileParams } from '../michlolPopulatedFile'; +import michlolPopulatedFile from '../michlolPopulatedFile'; import * as yearUtil from '@shared/utils/entity/year.util'; import * as reportDataUtil from '@shared/utils/reportData.util'; import * as studentReportDataUtil from 'src/utils/studentReportData.util'; diff --git a/server/src/reports/michlolPopulatedFile.ts b/server/src/reports/michlolPopulatedFile.ts index 4664fd2e..ee6773fd 100644 --- a/server/src/reports/michlolPopulatedFile.ts +++ b/server/src/reports/michlolPopulatedFile.ts @@ -74,7 +74,7 @@ const getReportData: IGetReportDataFunction = async ( const studentReports = studentReportsMap[studentId] || []; const studentKnownAbsences = knownAbsencesMap[studentId] || []; - const { attPercents, absCount, approvedAbsCount, gradeAvg, lessonsCount, lastGrade } = calcReportsData( + const { attPercents, absCount, approvedAbsCount, lastGrade } = calcReportsData( studentReports, studentKnownAbsences, ); diff --git a/server/src/yemot-handler.service.ts b/server/src/yemot-handler.service.ts index e29ddb7c..d9c43b9b 100644 --- a/server/src/yemot-handler.service.ts +++ b/server/src/yemot-handler.service.ts @@ -16,8 +16,9 @@ import { Between, In } from 'typeorm'; const SCHEDULE_MATCH_TOLERANCE_MINUTES = 90; /** - * Yemot Handler Service for processing incoming Yemot calls - * Currently returns a maintenance mode message + * Yemot Handler Service for processing incoming Yemot calls. + * Hangs up with a maintenance message when configured; otherwise routes to the + * manager report status, seminar attendance, or transportation report flow. */ @Injectable()