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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions client/src/entities/student-percent-report.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,8 +14,6 @@ import { adminUserFilter } from '@shared/components/fields/PermissionFilter';

const filters = [
adminUserFilter,
// <DateInput source="reportDate:$gte" label="תאריך דיווח אחרי" alwaysOn />,
// <DateInput source="reportDate:$lte" label="תאריך דיווח לפני" alwaysOn />,
<CommonReferenceInputFilter
source="studentReferenceId"
reference="student_by_year"
Expand Down
4 changes: 0 additions & 4 deletions server/src/db/view-entities/StudentByYear.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ export class StudentByYear implements IHasUserId {

@Column('simple-array', { nullable: true })
klassTypeReferenceIds: string[];

// @ManyToOne(() => Student, { createForeignKeyConstraints: false })
// @JoinColumn({ name: 'id' })
// student: Student;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -108,7 +106,7 @@ class AttReportWithReportMonthService<T extends Entity | AttReportWithReportMont

@Override()
async deleteOne(req: CrudRequest<any>): Promise<void | T> {
const attReportService = new BaseEntityService(this.dataSource.getRepository(AttReport), this.mailSendService);
const attReportService = this.getAttReportService();
return attReportService.deleteOne(req) as Promise<void | T>;
}

Expand Down
7 changes: 5 additions & 2 deletions server/src/entity-modules/student-by-year.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -197,7 +197,10 @@ class StudentByYearService<T extends Entity | StudentByYear> extends BaseEntityS
}),
]);

const headers: Record<string, { value: string; label: string; numFmt?: string; thresholds?: any }> = {};
const headers: Record<
string,
{ value: string; label: string; numFmt?: string; thresholds?: readonly AbsenceThreshold[] }
> = {};
const rawAbs: Record<number, Record<string, number>> = {};
const rawLessons: Record<number, Record<string, number>> = {};
const rawKnownAbs: Record<number, Record<string, number>> = {};
Expand Down
23 changes: 18 additions & 5 deletions server/src/entity-modules/student-percent-report.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -67,14 +67,21 @@ function getConfig(): BaseEntityModuleOptions {
};
}

interface IStudentPercentReportDebug {
absCountEffectId: string;
gradeEffectId: string;
absCountEffect: IGradeEffect;
gradeEffect: IGradeEffect;
Comment thread
buzz-code marked this conversation as resolved.
Resolved
}

interface StudentPercentReportWithDates extends StudentPercentReport {
approvedAbsCount?: number;
attGradeEffect?: number;
finalGrade?: string;
finalAttendance?: string;
estimation?: string;
comments?: string;
debug?: any;
debug?: IStudentPercentReportDebug;
}
class StudentPercentReportService<T extends Entity | StudentPercentReport> extends BaseEntityService<T> {
protected async populatePivotData(pivotName: string, list: T[], extra: any, filter: any, auth: any) {
Expand Down Expand Up @@ -205,17 +212,23 @@ 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<T extends IEffectViewRow>(
dataSource: DataSource,
viewEntity: any,
viewEntity: EntityTarget<T>,
ids: string[],
): Promise<Record<string, IGradeEffect>> {
return dataSource
.getRepository(viewEntity)
.find({
where: {
id: In(ids),
},
} as FindOptionsWhere<T>,
select: ['id', 'effect', 'effectPercent'],
})
.then((arr) =>
Expand Down
2 changes: 1 addition & 1 deletion server/src/reports/__tests__/michlolPopulatedFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion server/src/reports/michlolPopulatedFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
5 changes: 3 additions & 2 deletions server/src/yemot-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading