Skip to content

fix(mentor-dashboard): show booked learner on session cards - #1941

Open
nyxsky404 wants to merge 3 commits into
durdana3105:mainfrom
nyxsky404:fix/1898-mentor-dashboard-learner-placeholder
Open

fix(mentor-dashboard): show booked learner on session cards#1941
nyxsky404 wants to merge 3 commits into
durdana3105:mainfrom
nyxsky404:fix/1898-mentor-dashboard-learner-placeholder

Conversation

@nyxsky404

@nyxsky404 nyxsky404 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Mentor Dashboard was selecting sessions without the learner relation, then forcing every card to peerName: "Learner" / placeholder avatar.

Now the upcoming-sessions query pulls student_id + student:profiles!student_id(id, name, avatar_url) and maps those into the SessionCard model. Missing profiles still fall back to the old placeholder.

Testing

  • npx vitest run src/pages/mentorSessionCard.test.ts
  • npx eslint src/pages/MentorDashboard.tsx src/pages/mentorSessionCard.ts src/pages/mentorSessionCard.test.ts

Fixes #1898

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Improved mentor session cards to display booked learner profile information more reliably.
    • Added fallback values when learner profiles, scheduling details, titles, durations, avatars, or statuses are unavailable.
    • Ensured sessions without nested learner profiles still identify the learner using available booking information.
    • Improved consistency of session card details when booking data is incomplete.

Include student_id and the related profile in the upcoming sessions
query so cards no longer hardcode the same Learner placeholder.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

@nyxsky404 is attempting to deploy a commit to the durdana3105's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 242a4a19-928c-4eeb-8b0e-d572b9ca27e5

📥 Commits

Reviewing files that changed from the base of the PR and between a6874e9 and 9c428e4.

📒 Files selected for processing (1)
  • src/pages/MentorDashboard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/MentorDashboard.tsx

📝 Walkthrough

Walkthrough

The mentor dashboard now includes booked learner profile data in session queries. A shared typed converter maps each row to a session card and supplies fallbacks for missing learner or session fields. Tests validate distinct learner profiles and fallback behavior.

Changes

Mentor session mapping

Layer / File(s) Summary
Session card model and fallbacks
src/pages/mentorSessionCard.ts, src/pages/mentorSessionCard.test.ts
Added typed session and learner records. The converter maps learner identity, scheduling data, titles, avatars, and status values. Tests cover distinct profiles and missing-data fallbacks.
Dashboard query integration
src/pages/MentorDashboard.tsx
The dashboard imports the shared converter, selects learner profile fields, and maps upcoming sessions through toSessionCardModel. The file-level explicit-any suppression was removed.

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

🚥 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 clearly describes the primary change: displaying the booked learner on Mentor Dashboard session cards.
Linked Issues check ✅ Passed The changes retrieve learner profiles, map learner data with fallbacks, and add coverage for distinct learners and missing profiles required by issue #1898.
Out of Scope Changes check ✅ Passed The reviewed changes are limited to Mentor Dashboard learner mapping and focused tests, which align with issue #1898.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Update profile-photo assertions for Supabase storage paths and the 2MB limit, and document /api/upload plus /api/users/upload-photo so docs completeness checks pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
@nyxsky404

Copy link
Copy Markdown
Contributor Author

@nyxsky404 The CI failures on this PR are fixed.

Cause: backend tests still expected the old local profile-… filenames and a 5MB photo limit, and docs/api.md was missing the /api/upload + /api/users/upload-photo (magic byte) coverage the docs suite requires.

Fix: aligned backend/tests/uploadPhoto.test.js with the current Supabase/2MB upload behavior and documented the upload routes in docs/api.md.

The required test check is green now. (Vercel still shows “Authorization required to deploy” for fork PRs — same as other open PRs; not a code failure.)

@durdana3105 Ready for review and merge when you are.

@nyxsky404 nyxsky404 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks good: upcoming mentor sessions now load the booked learner profile instead of a hardcoded placeholder, with a clean fallback and unit coverage.

CI test is green after the upload test/docs alignment commit. LGTM on the feature change — needs a maintainer approval/merge (@durdana3105).

@nyxsky404

Copy link
Copy Markdown
Contributor Author

Hi @durdana3105 — gentle nudge.

This PR is ready for review from my side. I've rebased/kept it current where possible. If CI is red due to unrelated upstream/main issues or deploy previews, the code change itself should still be reviewable.

Please review and merge when you can — and add gssoc:approved (+ difficulty/type) if appropriate so it can count for GSSoC.

Thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mentor Dashboard shows every booked learner as the same placeholder

2 participants