feat: add mock interview history and analytics dashboard#862
Conversation
|
Someone is attempting to deploy a commit to the durdana3105's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCreates ChangesInterview History & Analytics
Sequence DiagramsequenceDiagram
participant User
participant MockInterview
participant Supabase
participant InterviewHistory
User->>MockInterview: Complete interview
MockInterview->>Supabase: INSERT interview_sessions
Supabase-->>MockInterview: Session persisted / error
MockInterview-->>User: Display report + "View History"
User->>InterviewHistory: Navigate /interview-history
InterviewHistory->>Supabase: SELECT user's sessions
Supabase-->>InterviewHistory: Sessions retrieved
InterviewHistory-->>User: Render score chart + session list
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pages/InterviewHistory.tsx`:
- Around line 79-159: The page is missing aggregation of recurring improvement
areas across sessions; add logic to compute and display recurring improvements
by scanning the sessions array (the same data used for chartData and session
list), e.g., implement a helper (computeRecurringImprovements or
deriveRecurringImprovements) that flattens session.improvements, counts
frequencies, sorts by count, and returns top N items, then render a new UI block
(e.g., a "Recurring Improvements" card) under the Score Chart using that helper;
reference the existing sessions variable and ensure you reuse or memoize the
result (useMemo or equivalent) so it updates when sessions change and ties into
expandedId/session rendering flow.
- Around line 27-35: fetchSessions currently treats Supabase errors as an empty
result by only calling setSessions when "!error && data" and then always calling
setLoading(false); change fetchSessions to explicitly handle errors: detect when
"error" is truthy, set an error state (e.g., setFetchError or reuse existing
state), do not clear sessions to an empty array in that case, and ensure the
component renders a failure message instead of the empty-state; update the
fetchSessions flow around the Supabase call and the setLoading/setSessions calls
so successful responses call setSessions(data) and clear any error, while
failures set the error state and setLoading(false) without overwriting existing
sessions.
In `@src/pages/MockInterview.tsx`:
- Around line 140-148: The Supabase insert call using (supabase as
any).from("interview_sessions").insert(...) is not checking the returned { error
} so failures are silent; update the code after this insert to inspect the
returned result (error) and handle it explicitly—either throw the error so the
outer try/catch handles it or set an error state and avoid calling
setReport(data) (or revert it) when insert fails; reference the insert call and
the setReport(data) usage in MockInterview.tsx and ensure the error path
surfaces a user-visible failure/rollback and logs the Supabase error details.
In `@supabase/migrations/20260608000000_interview_sessions.sql`:
- Around line 8-10: The migration must enforce analytics invariants: update the
interview_sessions column definitions so overall_score has a CHECK enforcing
0–100 (e.g., add "CHECK (overall_score BETWEEN 0 AND 100)") and make created_at
NOT NULL with a default now() so timestamps are always present; modify the
CREATE TABLE/column lines for overall_score and created_at (or add equivalent
ALTER TABLE constraints) to implement these checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2984f597-6dfb-48d8-bd8e-a0d5404813ea
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
src/App.tsxsrc/pages/InterviewHistory.tsxsrc/pages/MockInterview.tsxsupabase/migrations/20260608000000_interview_sessions.sql
…ts, DB constraints
|
Hi @durdana3105, could you please review this PR? I've addressed all the issues and suggestions raised by CodeRabbit. Thank you! |
|
this have merge conflicts |
|
Heyy @durdana3105 Just a note — the 2 failing checks (CI test and Vercel) are pre-existing infrastructure issues unrelated to this PR:
Would love to get your feedback whenever you get a chance. Thank you! 🙏 |
🚀 Feature: Mock Interview History & Analytics Dashboard
Closes #839
📋 Changes Made
New Files
supabase/migrations/20260608000000_interview_sessions.sql— creates theinterview_sessionstable with RLS policies (users can only read/insert/delete their own sessions)src/pages/InterviewHistory.tsx— new page showing past interview sessions with score progression chart and expandable session detailsModified Files
src/pages/MockInterview.tsx— saves completed interview session (role, messages, strengths, improvements, score, summary) to the database after report generation. Added "View History" button on the report screensrc/App.tsx— added lazy import and/interview-historyprotected route✨ What This Feature Does
/interview-historyto view all past sessions🗃️ Database
New table
interview_sessions:RLS is enabled — users can only access their own sessions.
📝 Notes
supabase as anyfor the new table queries sincetypes.tswill need to be regenerated after the migration runs (supabase gen types typescript)🎯 Program
GSSoC26
Summary by CodeRabbit
New Features
Bug Fixes / UX