AfterClass-io / afterclass.io-v2

[alpha] v2 of https://afterclass.io!
https://afterclass-io.vercel.app
MIT License
5 stars 2 forks source link

fix: prof filter on course page not correctly filtering reviews #193

Closed davidlhw closed 1 month ago

davidlhw commented 1 month ago

closes #180

Context

When we filter a course page for a particular prof, we expect to only see information / reviews of this prof for this course and nothing else.

The current behavior is to show all course reviews that are not tagged to a prof, along with that particular prof's reviews. Hence filtering for profs that dont have reviews still unexpectedly show reviews in the review section as those reviews are only written for courses and do not have a corresponsing reviewedProfessor

Changes

update reviews trpc procedure's primsa query when fetching for reviews belonging to this course when filtered by a particular prof

Implementation Details

query for reviews with prof slug only when slug exists in the input param of the trpc procedure, otherwise, get all course reviews

How to Test

  1. head to /course/COR-IS1702
  2. filter on profs with 0 reviews
  3. no longer see reviews on review section

Preview / Screenshots

No Filter

image

Filtering for Prof with Reviews

Stats are different from no filter version as there are course reviews that arent reviewed with a prof

image

Filtering for Prof with Reviews

image

Checklist

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
afterclass-io-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 3:35pm