Skip to content

Refactor to reviews-only flow and add OAuth consent, restore working condition#63

Merged
Ashish-Kumar-Dash merged 7 commits into
OpenLake:mainfrom
Ashish-Kumar-Dash:feat/working-condition
May 25, 2026
Merged

Refactor to reviews-only flow and add OAuth consent, restore working condition#63
Ashish-Kumar-Dash merged 7 commits into
OpenLake:mainfrom
Ashish-Kumar-Dash:feat/working-condition

Conversation

@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor

@Ashish-Kumar-Dash Ashish-Kumar-Dash commented May 25, 2026

Remove legacy ratings API + form and align types to the reviews schema
Compute course/professor stats directly from community reviews (no trigger dependency)
Add OAuth consent page and fix course review fetching by UUID

Summary by CodeRabbit

Release Notes

  • New Features

    • Course ratings now include difficulty and workload dimensions for more detailed feedback.
    • Professor ratings now include knowledge, teaching, and approachability dimensions.
    • Added OAuth consent screen for Google authentication.
  • Improvements

    • Dashboard now displays reviews with comprehensive rating breakdowns.
    • Replaced ratings system with enhanced reviews system.
  • Removals

    • Removed standalone ratings and rating voting functionality.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d712569b-c9ea-452e-952d-da8c272829a3

📥 Commits

Reviewing files that changed from the base of the PR and between 5ec9043 and ce09a68.

📒 Files selected for processing (18)
  • src/app/courses/[courseId]/page.tsx
  • src/app/dashboard/page.tsx
  • src/app/oauth/consent/page.tsx
  • src/app/professors/[professorId]/page.tsx
  • src/components/courses/ItemList.tsx
  • src/components/courses/course_page/CoursePageHeader.tsx
  • src/components/courses/course_page/CoursePageReviews.tsx
  • src/components/courses/course_page/CoursePageStats.tsx
  • src/components/professors/professor_page/ProfessorPageStats.tsx
  • src/components/ratings/RatingForm.tsx
  • src/lib/data/reviews.tsx
  • src/migrations/migration.sql
  • src/pages/api/courses/[id].ts
  • src/pages/api/ratings/my-ratings/route.ts
  • src/pages/api/ratings/route.ts
  • src/pages/api/ratings/vote/route.ts
  • src/types/index.ts
  • src/types/supabase.ts

Walkthrough

This PR migrates the application from a separate ratings table model to an embedded review-dimensions model. The Supabase schema is restructured to denormalize rating metrics into courses and professors tables, with a unified reviews table containing all rating dimensions. Legacy rating creation and voting APIs are removed, along with the RatingForm component. All pages and components are rewired to compute and display aggregated review dimensions.

Changes

Reviews Model Migration

Layer / File(s) Summary
Database schema and type definitions
src/types/supabase.ts, src/types/index.ts, src/migrations/migration.sql
Supabase schema redefined: courses and professors gain rating-metric columns (overall_rating, difficulty_rating, workload_rating, review_count/knowledge_rating, teaching_rating, approachability_rating, review_count). The reviews table now includes per-dimension ratings and a target_id/target_type model; votes and flags tables keyed by review_id replace the prior ratings/rating_votes/rating_flags structure. Users table reference corrected and legacy Rating types removed.
Remove legacy rating APIs and RatingForm component
src/lib/data/reviews.tsx, src/pages/api/courses/[id].ts
Rating creation (/api/ratings), voting (/api/ratings/vote), and user-rating fetch (/api/ratings/my-ratings) endpoints removed. Course API endpoint updated to fetch and return reviews instead of ratings, filtering by target_id and target_type = 'course'. RatingForm component deleted entirely.
Course page review aggregation and component wiring
src/app/courses/[courseId]/page.tsx, src/components/courses/course_page/CoursePageHeader.tsx, src/components/courses/course_page/CoursePageStats.tsx, src/components/courses/course_page/CoursePageReviews.tsx
CoursePage now fetches overall rating, difficulty_rating, and workload_rating from reviews, computes per-dimension averages formatted to 1 decimal, and passes them to child components. CoursePageStats refactored to display four rating dimensions (overall, difficulty, workload, reviews count) with updated icons (Star, Flame, Zap, MessageSquare). CoursePageReviews now accepts nullable id and skips the query when missing.
Professor page review aggregation and stats display
src/app/professors/[professorId]/page.tsx, src/components/professors/professor_page/ProfessorPageStats.tsx
ProfessorPage fetches and aggregates overall rating, knowledge_rating, teaching_rating, and approachability_rating dimensions, computing 1-decimal averages. ProfessorPageStats refactored to accept explicit numeric props (removing optional professor object) and displays all four ratings with a secondary review-count line under the overall rating stat.
Dashboard and ItemList simplification
src/app/dashboard/page.tsx, src/components/courses/ItemList.tsx
Dashboard page removes user ratings fetch and simplifies to a single "Your Reviews" section displaying user reviews with optional review-dimension fields (difficulty, workload, knowledge, teaching, approachability). ItemList component removes Supabase ratings aggregation for professors and simplifies loading state logic, now depending only on data hook loading flags.
New OAuth consent flow page
src/app/oauth/consent/page.tsx
New client-side consent page component that displays OAuth permissions, requires checkbox acceptance, and gates the "Continue with Google" button with loading/accepted states. Includes fade-in animations and a link back to sign-in.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • OpenLake/RateMyCourse#39: Both PRs update the course/professor pages to read from the new reviews-based schema (e.g., rating_value/per-dimension ratings) and wire those computed values into the corresponding stats/reviews components, sharing direct code changes in the same page/components.

Poem

🐰 From ratings scattered far and wide,
We've gathered reviews side by side,
Difficulty, workload, knowledge too—
One table holds what's honest and true.
The consent page dances in, so neat,
Making user journeys complete! 🌟

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 timed out. The project may have too many dependencies for the sandbox.


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 and usage tips.

@Ashish-Kumar-Dash Ashish-Kumar-Dash merged commit 63f05b5 into OpenLake:main May 25, 2026
1 check was pending
@coderabbitai coderabbitai Bot mentioned this pull request May 26, 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

Development

Successfully merging this pull request may close these issues.

1 participant