Skip to content

⚡ Bolt: scope user lesson progress database queries to lesson IDs#74

Open
projectamazonph wants to merge 1 commit into
mainfrom
fix/bolt-scope-lesson-progress-queries-15107616431700706947
Open

⚡ Bolt: scope user lesson progress database queries to lesson IDs#74
projectamazonph wants to merge 1 commit into
mainfrom
fix/bolt-scope-lesson-progress-queries-15107616431700706947

Conversation

@projectamazonph

@projectamazonph projectamazonph commented Jul 22, 2026

Copy link
Copy Markdown
Owner

💡 What

Scoped the user's lessonProgress queries on the dashboard (src/app/(dashboard)/dashboard/page.tsx), courses index (src/app/(dashboard)/courses/page.tsx), and pending certificate lessons (src/app/(dashboard)/courses/[courseSlug]/certificate/page.tsx) to only query matching relevant lesson IDs using { lessonId: { in: allLessonIds } }.

🎯 Why

Previously, these pages retrieved the student's entire unconstrained lesson progress history from the database. As students complete more lessons across multiple courses, fetching unconstrained history results in unnecessary database payload, memory bloating, and progressive query degradation.

📊 Impact

  • Scopes the retrieved lessonProgress rows specifically to the context being viewed.
  • Prevents database payload and memory footprint from scaling linearly with the user's total history.

🔬 Measurement

All Vitest unit/integration tests and typecheck checks pass successfully.


PR created automatically by Jules for task 15107616431700706947 started by @projectamazonph

Summary by CodeRabbit

  • Performance

    • Improved course, dashboard, and certificate progress loading by limiting progress data to relevant lessons.
    • Skips unnecessary progress lookups when courses contain no lessons.
  • Bug Fixes

    • Progress calculations now exclude deleted records and unrelated lesson history, ensuring more accurate course-specific results.

Scope lessonProgress database queries in key dashboard, course index, and pending lessons certificate pages to relevant course or published-course lesson IDs using `{ lessonId: { in: allLessonIds } }`. This avoids fetching the student's entire history, minimizing database payload size and memory consumption as progress records accumulate over time.

Co-authored-by: projectamazonph <286085559+projectamazonph@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 22, 2026 13:54
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 343a877f-423e-4d24-9819-b4c12f4f19c9

📥 Commits

Reviewing files that changed from the base of the PR and between dabee94 and 6c118d6.

📒 Files selected for processing (4)
  • .jules/bolt.md
  • src/app/(dashboard)/courses/[courseSlug]/certificate/page.tsx
  • src/app/(dashboard)/courses/page.tsx
  • src/app/(dashboard)/dashboard/page.tsx

📝 Walkthrough

Walkthrough

Dashboard, course index, and certificate pages now scope lessonProgress queries to relevant lesson IDs, exclude deleted rows, and skip queries when no lesson IDs exist. A Bolt journal entry documents this query-scoping guidance.

Changes

Lesson progress query scoping

Layer / File(s) Summary
Published-course progress reads
src/app/(dashboard)/dashboard/page.tsx, src/app/(dashboard)/courses/page.tsx, .jules/bolt.md
Dashboard and course index pages derive published lesson IDs before fetching non-deleted user progress, with empty-result fallbacks. The journal documents the scoping pattern.
Certificate pending lesson progress
src/app/(dashboard)/courses/[courseSlug]/certificate/page.tsx
PendingLessons derives course lesson IDs and builds its completed set from matching completion records, or an empty set when the course has no lessons.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: scoping lesson progress queries to relevant lesson IDs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bolt-scope-lesson-progress-queries-15107616431700706947

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants