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
2 changes: 2 additions & 0 deletions client/src/domainTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export default {
reportMonthReferenceId: 'תקופת דיווח',
reportedLessons: 'שיעורים שדווחו',
notReportedLessons: 'שיעורים שלא דווחו',
hasNotReportedLessons: 'יש שיעורים שלא דווחו',
},
},
teacher_reported_today: {
Expand All @@ -362,6 +363,7 @@ export default {
reportMonthReferenceId: 'תקופת דיווח',
reportedLessons: 'שיעורים שדווחו',
notReportedLessons: 'שיעורים שלא דווחו',
hasNotReportedLessons: 'יש שיעורים שלא דווחו',
},
},
student_percent_report: {
Expand Down
6 changes: 4 additions & 2 deletions client/src/entities/teacher-grade-report-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TextField,
required,
BooleanInput,
NullableBooleanInput,
TextInput,
useGetList,
} from 'react-admin';
Expand All @@ -28,6 +29,7 @@ const filters = [
dynamicFilter={filterByUserId}
/>,
<CommonYearInputFilter />,
<NullableBooleanInput source="hasNotReportedLessons" />,
];

const filterDefaultValues = {
Expand Down Expand Up @@ -86,8 +88,8 @@ const Datagrid = ({ isAdmin, children, ...props }) => {
<TextField source="teacherComment" />
<ReferenceField source="reportMonthReferenceId" reference="report_month" sortBy="reportMonthName" />
<CommonYearField />
<ReferenceArrayField source="reportedLessons" reference="lesson" sortBy="reportedLessonNames" />
<ReferenceArrayField source="notReportedLessons" reference="lesson" sortBy="notReportedLessonNames" />
<ReferenceArrayField source="reportedLessons" reference="lesson" sortBy="reportedLessonsCount" sortByOrder="DESC" />
<ReferenceArrayField source="notReportedLessons" reference="lesson" sortBy="notReportedLessonsCount" sortByOrder="DESC" />
</CommonDatagrid>
);
};
Expand Down
6 changes: 4 additions & 2 deletions client/src/entities/teacher-report-status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TextField,
required,
BooleanInput,
NullableBooleanInput,
TextInput,
useGetList,
} from 'react-admin';
Expand All @@ -28,6 +29,7 @@ const filters = [
dynamicFilter={filterByUserId}
/>,
<CommonYearInputFilter />,
<NullableBooleanInput source="hasNotReportedLessons" />,
];

const filterDefaultValues = {
Expand Down Expand Up @@ -86,8 +88,8 @@ const Datagrid = ({ isAdmin, children, ...props }) => {
<TextField source="teacherComment" />
<ReferenceField source="reportMonthReferenceId" reference="report_month" sortBy="reportMonthName" />
<CommonYearField />
<ReferenceArrayField source="reportedLessons" reference="lesson" sortBy="reportedLessonNames" />
<ReferenceArrayField source="notReportedLessons" reference="lesson" sortBy="notReportedLessonNames" />
<ReferenceArrayField source="reportedLessons" reference="lesson" sortBy="reportedLessonsCount" sortByOrder="DESC" />
<ReferenceArrayField source="notReportedLessons" reference="lesson" sortBy="notReportedLessonsCount" sortByOrder="DESC" />
</CommonDatagrid>
);
};
Expand Down
2 changes: 2 additions & 0 deletions client/src/roadmapFeatures.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions server/src/db/view-entities/TeacherGradeReportStatus.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import { getGroupConcatExpression } from '@shared/utils/entity/column-types.util
),
'notReportedLessonNames',
)
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 1 THEN tlrs.lessonId END)', 'reportedLessonsCount')
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 0 THEN tlrs.lessonId END)', 'notReportedLessonsCount')
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 0 THEN tlrs.lessonId END) > 0', 'hasNotReportedLessons')
.from(TeacherLessonGradeReportStatus, 'tlrs')
.leftJoin(Teacher, 'teacher', 'tlrs.teacherId = teacher.id')
.leftJoin(ReportMonth, 'rm', 'tlrs.reportMonthId = rm.id')
Expand Down Expand Up @@ -94,4 +97,13 @@ export class TeacherGradeReportStatus implements IHasUserId {

@Column()
notReportedLessonNames: string;

@ViewColumn()
reportedLessonsCount: number;

@ViewColumn()
notReportedLessonsCount: number;

@ViewColumn()
hasNotReportedLessons: boolean;
}
12 changes: 12 additions & 0 deletions server/src/db/view-entities/TeacherReportStatus.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import { getGroupConcatExpression } from '@shared/utils/entity/column-types.util
),
'notReportedLessonNames',
)
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 1 THEN tlrs.lessonId END)', 'reportedLessonsCount')
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 0 THEN tlrs.lessonId END)', 'notReportedLessonsCount')
.addSelect('COUNT(DISTINCT CASE WHEN tlrs.isReported = 0 THEN tlrs.lessonId END) > 0', 'hasNotReportedLessons')
.from(TeacherLessonReportStatus, 'tlrs')
.leftJoin(Teacher, 'teacher', 'tlrs.teacherId = teacher.id')
.leftJoin(ReportMonth, 'rm', 'tlrs.reportMonthId = rm.id')
Expand Down Expand Up @@ -94,4 +97,13 @@ export class TeacherReportStatus implements IHasUserId {

@Column()
notReportedLessonNames: string;

@ViewColumn()
reportedLessonsCount: number;

@ViewColumn()
notReportedLessonsCount: number;

@ViewColumn()
hasNotReportedLessons: boolean;
}
Loading
Loading