Repository navigation
Add lesson schedule Excel upload with Yemot auto-detect - #104
Merged
Merged
Conversation
Admins can upload a daily teacher lesson-schedule Excel file into a new LessonSchedule entity (natural-key resolved against Klass/Lesson/Teacher, same pattern as Lesson/AttReport). Re-uploading a date replaces its rows. The seminar attendance Yemot call flow now looks up the calling teacher's current lesson from that schedule (nearest start time to now) instead of always asking for a klass number by keypad, and records the resolved lesson on the saved AttReport rows. Falls back to the existing manual klass-entry flow when no schedule match is found. The new resource is gated behind a new lessonSchedule app permission.
Field/filter labels are already defined under the lesson_schedule resource in domainTranslations.js, so explicit label props were redundant.
There was a problem hiding this comment.
Pull request overview
Adds a new lesson_schedule data model and UI workflow for importing daily lesson schedules from Excel, and uses that schedule to auto-detect the current lesson during Yemot seminar attendance calls (persisting lessonReferenceId on generated AttReport rows) with a fallback to the existing manual klass entry path.
Changes:
- Introduce
LessonScheduleentity + migration + entity-module registration for CRUD/export. - Add React-Admin resource + Excel import/preview flow for
lesson_schedule, gated behind a newlessonSchedulepermission. - Update Yemot seminar attendance flow to attempt schedule-based klass/lesson detection; add tests for both match and fallback.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/src/yemot-handler.service.ts | Adds schedule lookup and lessonReferenceId propagation during seminar attendance calls. |
| server/src/yemot-handler.service.test.ts | Adds scenario tests for schedule auto-detect and fallback behavior. |
| server/src/migrations/1783407769935-AddLessonSchedule.ts | Creates lesson_schedules table and indexes. |
| server/src/entity-modules/lesson-schedule.config.ts | Registers CRUD/export configuration for LessonSchedule. |
| server/src/entities.module.ts | Registers lesson_schedule module + display name mapping. |
| server/src/db/entities/LessonSchedule.entity.ts | Defines LessonSchedule entity + reference-id resolution hooks. |
| client/src/utils/appPermissions.js | Adds lessonSchedule application permission helpers. |
| client/src/roadmapFeatures.js | Marks the feature as completed in the roadmap list. |
| client/src/entities/lesson-schedule.jsx | Adds React-Admin resource screens + list action for importing schedules. |
| client/src/domainTranslations.js | Adds translations for the new lesson_schedule resource fields. |
| client/src/components/LessonScheduleImportButton.jsx | Adds Excel import/preview/save flow with lesson+group split and date replacement. |
| client/src/App.jsx | Registers the lesson_schedule resource in the UI behind permission gating. |
Files not reviewed (1)
- client/src/roadmapFeatures.js: Generated file
Comment on lines
+62
to
+71
| const schedule = await this.getScheduleForTeacherNow(teacher); | ||
| let klass: Klass; | ||
| let lessonReferenceId: number | undefined; | ||
| if (schedule) { | ||
| klass = await this.dataSource.getRepository(Klass).findOneBy({ id: schedule.klassReferenceId }); | ||
| lessonReferenceId = schedule.lessonReferenceId; | ||
| } | ||
| if (!klass) { | ||
| klass = await this.getKlassByInput(); | ||
| } |
Addresses review comment: relying on implicit undefined made the fallback-to-manual-entry control flow less explicit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LessonScheduleentity for uploading a daily teacher lesson-schedule Excel file, with natural-key resolution againstKlass/Lesson/Teacher(same pattern asLesson/AttReport).LessonScheduleImportButton) that splits the combined "lesson number + group" Excel column and replaces existing rows for any date being re-uploaded (only once the admin confirms the save). Thelesson_scheduleresource is gated behind a newlessonScheduleapp permission.processSeminarAttendanceCall) to auto-detect the calling teacher's current lesson from the uploaded schedule (nearest start time to now), recordinglessonReferenceIdon the savedAttReportrows. Falls back to the existing manual klass-keypad entry when no schedule match is found.Test plan
cd server && yarn test— 905 tests passing, including two new scenario tests (schedule match auto-detect, and fallback to manual entry when no schedule exists)cd client && yarn test— 149 tests passingcd server && yarn buildandcd client && yarn buildsucceed🤖 Generated with Claude Code
Generated by Claude Code