Repository navigation
Conversation
…rior report Girls were punching the same lesson multiple times. When the resolved lesson+klass+teacher+date already has AttReport rows, the caller now gets a prompt: 1 = add another lesson (new rows saved on top), 2 = delete the previous rows for that lesson before the new report is saved. New IVR text keys (need manual DB setup, see PR): - SEMINAR.DUPLICATE_LESSON_PROMPT - SEMINAR.DUPLICATE_LESSON_DELETED Queries ride the existing att_teacher_lesson_date_idx - no migration.
There was a problem hiding this comment.
🟡 Changes recommended
Address the empty-roster ordering, session/group cleanup, and production text-seeding findings.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR adds duplicate scheduled-lesson handling to the seminar attendance IVR flow.
Changes:
- Detects existing lesson reports and offers add/delete choices.
- Deletes matching reports before saving a fresh report.
- Adds duplicate-flow scenarios and seminar text fixtures.
File summaries
| File | Summary | Review findings |
|---|---|---|
server/src/yemot-handler.service.ts |
Duplicate detection, deletion, and prompts | Moderate (2 votes): perform the empty-roster guard before duplicate deletion. Moderate (2 votes): clean up associated report sessions/groups when deleting reports. Moderate (2 votes): provide production text rows through migration or deployment seed. |
server/src/yemot-handler.service.test.ts |
Add/delete duplicate lesson scenarios | Nit (1 vote): seed multiple prior rows and assert complete bulk-deletion state. |
Review details
Suppressed comments (1)
server/src/yemot-handler.service.test.ts:638
- Only one prior
AttReportrow is seeded here, so this does not verify the promised bulk deletion of one row per student; a regression that deletes only one matching row still passes. Seed multiple matching rows and assert complete post-run state rather than relying on the runner's seed-count subtraction.
.seed('AttReport', [
{ id: 910, userId: 1, studentReferenceId: 101, klassReferenceId: 286, teacherReferenceId: 1, lessonReferenceId: 700, reportDate: today, absCount: 1 },
]);
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+120
to
+122
| if (lessonReferenceId) { | ||
| await this.handleLessonDuplicate(teacher, klass, lessonReferenceId); | ||
| } |
| }); | ||
| if (!existing) return; | ||
|
|
||
| const choice = await this.askForInputByKey('SEMINAR.DUPLICATE_LESSON_PROMPT', undefined, { |
Comment on lines
+153
to
+159
| await this.dataSource.getRepository(AttReport).delete({ | ||
| userId: this.user.id, | ||
| klassReferenceId: klass.id, | ||
| teacherReferenceId: teacher.id, | ||
| lessonReferenceId, | ||
| reportDate, | ||
| }); |
…s migration, stronger delete test - Check the klass roster (hang up when empty) before the duplicate prompt, so an empty-klass call can no longer delete prior rows. - On delete (option 2): remove the prior AttReport rows, then drop their ReportGroupSessions once no report row references them, and their ReportGroups once no session references them - all in one transaction. - Seed the two new texts via migration instead of manual DB setup (UpdateYemotTextsSeminarDuplicateLesson, user_id 0). - Delete-path test now seeds the full prior report (one row per student, one with absCount 1, two report sessions) and asserts the complete post-run DB state instead of the runner's seed-count arithmetic.
buzz-code
pushed a commit
that referenced
this pull request
Sep 16, 2026
Adds the duplicate-lesson-punch handling in processSeminarAttendanceCall (ask 1=add another, 2=delete previous, with cascade cleanup of now-unused ReportGroupSession/ReportGroup rows) plus its test coverage, alongside the previously added texts migration with a real timestamp. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WER1oSuN8tCQTNRU73Mi89
buzz-code
added a commit
that referenced
this pull request
Sep 17, 2026
Seminar duplicate-lesson guard (from PR #191, real migration timestamp)
TziporaStern
pushed a commit
to TziporaStern/react-admin-nestjs
that referenced
this pull request
Oct 17, 2026
Same texts as PR buzz-code#191's migration, filename/class timestamped with actual Date.now() instead of a rounded placeholder. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WER1oSuN8tCQTNRU73Mi89
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.
Problem
Client report (שיפי, Hadasa): girls validated the same lesson multiple times — "הבנות תיקפו כל שיעור כמה פעמים". The seminar attendance IVR flow had no duplicate check on the lesson punch.
Fix
In
processSeminarAttendanceCall(server/src/yemot-handler.service.ts), the klass roster is fetched first (empty roster → hang up withSEMINAR.NO_STUDENTS_IN_KLASS), and when the resolved schedule sets alessonReferenceId, the handler checksAttReportfor existing rows for the same user + klass + teacher + lesson + today's date (Israel date). If found, the caller is asked:ReportGroupSessions are deleted once no remainingAttReportrow references them, and each session'sReportGroupis deleted once no remaining session references it — a confirmation message is sent, then the new report is saved normally (creating its own fresh group/session assaveSeminarAttendancealready does).If no existing row is found, the flow is unchanged. Calls with no schedule match (no
lessonReferenceId) are unchanged — re-reporting the same klass on the same day without a schedule still works (existing test kept passing).Queries are keyed on existing columns and ride the existing
att_teacher_lesson_date_idx(teacherReferenceId, lessonReferenceId, reportDate) — no schema migration needed.Change is local to
server/src/; theserver/sharedandclient/sharedsubmodules are untouched.Texts seeding (migration)
The two new IVR texts are seeded automatically by migration
1789600000000-UpdateYemotTextsSeminarDuplicateLesson(inserts foruser_id0, following the existingUpdateYemotTexts*migration pattern;downdeletes them) — no manual DB setup needed:SEMINAR.DUPLICATE_LESSON_PROMPTSEMINAR.DUPLICATE_LESSON_DELETEDTests
Seminar block in
yemot-handler.service.test.ts(26/26 green):AttReportrows saved.absCount: 1, all referencing aReportGroupSession) plus a still-referenced session/row for another lesson; runs the flow against the real in-memory DataSource and asserts the complete post-run state: prior rows gone, exactly 3 fresh rows (students 101–103,absCount0), the now-unreferenced session deleted, its fully-unusedReportGroupdeleted, while the still-referenced session and its group survive.The rest of the suite shows the same pre-existing failures as the
origin/mainbaseline (verified identical failure list with/without the change).