Add Apple module content statistics - #377
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7313d416a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| module: modules, | ||
| materialsCount: sql<number>`( | ||
| SELECT count(*)::int FROM ${readingMaterials} rm | ||
| WHERE rm.module_id = ${modules.id} ${materialVisibility} |
There was a problem hiding this comment.
Add course scoping to module content counts
When a course item has a moduleId that points at a module in another course (the current PATCH handlers for assignments/presentations/quizzes/discussions accept moduleId directly without rechecking the module's course), these new aggregates key only on module_id, so /courses/:courseId/modules will count that foreign item for this module; for students this can also disclose that a published item exists in a course they cannot access. Please also constrain each count subquery by the item's course_id so stale or cross-course links cannot inflate or leak counts.
Useful? React with 👍 / 👎.
What changed
Why
The module roadmap showed sequence and schedule but not the amount of learning content or assessment work inside each module. The new metrics make module workload and content density scannable without opening each module.
Validation
git diff --checkpassesNo database migration is required; the change only adds aggregate fields to an existing API query.