Skip to content

Quiz batch generation, custom feedback, course waitlist (Closes #308, #309, #310, #311) - #453

Merged
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
onyinyechinwokwu-success:feat/308-309-310-311-quiz-course-modules
Aug 31, 2026
Merged

Quiz batch generation, custom feedback, course waitlist (Closes #308, #309, #310, #311)#453
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
onyinyechinwokwu-success:feat/308-309-310-311-quiz-course-modules

Conversation

@onyinyechinwokwu-success

@onyinyechinwokwu-success onyinyechinwokwu-success commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves all four issues assigned to me in this wave: #308, #309, #310, #311.

Update: while rebasing onto main, PR #440 (issues #320-323) merged in and turned out to (a) duplicate my #309/#310 work with an equivalent implementation, and (b) contain a corrupted merge that broke main's build (deleted several unrelated tables/methods — notifications, course_shares, batchEnroll, getPrerequisites, archiveCourse, publishCourse, duplicateCourse, most of CourseController). This PR has been reworked accordingly — see the breakdown below.

Also fixed

Scope note on the broken build

Per direction, this PR does not attempt to fix the rest of #440's regression (the deleted notifications/course_shares tables, batchEnroll, getPrerequisites, archiveCourse, publishCourse, duplicateCourse, or the several other stripped CourseController methods that course.routes.ts/admin-course.controller.ts still call). That's a separate, much larger cleanup outside these 4 issues' scope — flagging it here for maintainer awareness. I verified with a side-by-side npm run typecheck/npm test run against plain main that every remaining failure already exists there unchanged; this PR fixes the 6 leaderboard-specific errors (part of #311) and introduces zero new ones.

Test plan

  • npm run typecheck — verified via a direct diff against plain main's error output: this branch has exactly 6 fewer errors (the leaderboard fix) and zero new ones.
  • npm run lint — 0 errors introduced (2 pre-existing errors in tests/e2e/course-waitlist.test.ts, a file this PR never touches, exist identically on main).
  • npm test — verified via a direct diff against plain main's failure list: this branch's failing-test list is main's exact list minus the leaderboard test (now passing), zero new failures.
  • New tests: src/test/quiz-generate-batch.test.ts (batch generation, per-module independence, existing-quiz reuse), src/test/course-waitlist.test.ts (dropEnrollment, the audit-log notification, and confirming enroll()'s existing waitlist cleanup still works) — both pass against a live Postgres+Redis where reachable; tests/unit/quizzes/ai-client.test.ts's and tests/unit/courses/enrollment-limit.test.ts's pre-existing mocked-DB tests are unaffected (verified their call sequences still match).

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@onyinyechinwokwu-success Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

archiveCourse (ChainLearnOfficial#358) logs a "course.archived" audit event that wasn't
in the AuditEvent type, breaking `npm run typecheck` for anyone
building on main.
ChainLearnOfficial#308)

Generates quizzes for multiple modules of a course in one request,
reusing generateQuiz's per-module enrollment check, rate limit,
existing-quiz short-circuit, and AI-fallback path. Modules are
generated sequentially to avoid bursting the AI service, and each
module's success/failure is reported independently so one failing
module (e.g. its own per-module rate limit) doesn't block the rest of
the batch. A dedicated route-level rate limit caps how often the batch
endpoint itself can be called.
…ial#310)

Adds a per-course FIFO waitlist:
- POST/DELETE /api/v1/courses/:id/waitlist to join/leave
- DELETE /api/v1/courses/:id/enroll to drop an enrollment — the
  companion action to enroll() that didn't previously exist, needed to
  give "a spot opens up" concrete meaning in this codebase
- dropEnrollment notifies the waitlist head via the notifications
  table; the notified user stays queued until they actually enroll,
  at which point enroll() cleans up their waitlist entry automatically

enroll()'s waitlist cleanup is nested under the same course-scoped
`waitlist:{courseId}` lock used by joinWaitlist/leaveWaitlist/
notifyNextWaitlisted, so position numbers can't develop a gap from a
join/leave racing an enrollment on the same course.
@onyinyechinwokwu-success
onyinyechinwokwu-success force-pushed the feat/308-309-310-311-quiz-course-modules branch from 3b77c81 to 334089f Compare August 31, 2026 18:26
@DeFiVC
DeFiVC merged commit 7428c42 into ChainLearnOfficial:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants