Skip to content

Conversation

jerryzhou196
Copy link
Member

@jerryzhou196 jerryzhou196 commented Nov 6, 2024

This PR creates a new Hasura migration that updates the review bucket views (course_easy_buckets, course_useful_buckets, prof_clear_buckets and prof_engaging_buckets) to only include reviews that have:

  1. A non-NULL liked value
  2. Either a non-NULL course_comment or prof_comment
  3. The relevant rating field being non-NULL (e.g. course_easy for course easy buckets)

It also adds the same materialized pattern and indexing implemented in #51 for the review bucket views for more optimized retrieval.

PR Summary Generated with AI Copilot:

This pull request updates the review bucket views and materialized views to include only reviews with a rating and either a professor or course rating. The most important changes include dropping and recreating views and materialized views, updating the conditions for review inclusion, and adding necessary indexes and triggers.

Changes to views and materialized views:

  • Dropped existing views and materialized views for course_easy_buckets, course_useful_buckets, prof_clear_buckets, and prof_engaging_buckets. [1] [2]
  • Recreated views and materialized views with updated conditions to include only reviews with a non-NULL liked value and either a course_comment or prof_comment.

Indexes and triggers:

  • Added indexes to the new materialized views for improved query performance.
  • Created a function and trigger to refresh the materialized views after any insert, update, or delete operation on the review table.

@jerryzhou196 jerryzhou196 self-assigned this Nov 6, 2024
jerryzhou196 added a commit to UWFlow/uwflow_frontend that referenced this pull request Jan 21, 2025
https://github.com/user-attachments/assets/fc85b72a-51cb-4dbd-8ccf-6eb2516c5b35

Associated Backend PR: UWFlow/uwflow#131

# PR Summary Generated With Copilot: 
This pull request introduces several changes to the codebase, focusing
on updating dependencies, adding a Rating Distribution view to the
professor and course view, fixing linting issues and a small error with
search. The most important changes include updating the `@tippyjs/react`
dependency, adding new components for displaying rating distributions,
and refactoring the search bar's event handling.

Dependency updates:

*
[`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L12-R12):
Updated the `@tippyjs/react` dependency from version 3.1.1 to 4.2.6.

Enhancements to rating display components:

*
[`src/components/display/Popover.tsx`](diffhunk://#diff-ae41bd09c234a31ccde043a215aebdd32816211f5b447dc21c3da0f4ef824520R1-R16):
Added a new `Popover` component to encapsulate popover functionality.
*
[`src/components/display/RatingBox.tsx`](diffhunk://#diff-2a71714fa1137deb904548f43e435136358f3af35cdb24bd55710acfe09b88c9R98-R117):
Integrated the new `Popover` component and added a
`RatingDistributionGraph` to display detailed rating distributions.
*
[`src/components/display/RatingDistributionGraph.tsx`](diffhunk://#diff-fab818bf5b76ffc6f131f7211285590a06dd937688aec67f31cc7c505ec97967R1-R56):
Created a new `RatingDistributionGraph` component to visualize rating
distributions.
*
[`src/components/display/styles/Popover.tsx`](diffhunk://#diff-4f4ae8919b82b2e8ad1c2cd537a41c7c3390762e94007a60c95f0c665e49f0f9R1-R24):
Added styled components for the `Popover` component.
*
[`src/components/display/styles/RatingDistributionGraph.tsx`](diffhunk://#diff-09c616ed955d723c7631e83f2170722005abcfb88c14931f5b51f0b8d33aba6dR1-R41):
Added styled components for the `RatingDistributionGraph` component.

Refactoring and improvements to search functionality:

*
[`src/components/navigation/SearchBar.tsx`](diffhunk://#diff-70cb21bd888ed884c770c9024fb863b0286a456d047cc9836ed076352113823bR103-R112):
Refactored the search bar to use `useEffect` for handling search worker
messages and key press events, improving readability and
maintainability.

GraphQL query updates:

*
[`src/graphql/fragments/CourseFragment.tsx`](diffhunk://#diff-1bbfe6ab5b0b3ab60f203e23b27acbf62b16b5c086e976e21213264b82cd8e2eR98-R110):
Added a new fragment `CourseReviewDistribution` to fetch course review
distributions.
*
[`src/graphql/fragments/ProfFragment.tsx`](diffhunk://#diff-0a85613d990247c70c81001c06d02e60c894ee396d6ced6d4b8072457f107608R34-R46):
Added a new fragment `ProfReviewDistribution` to fetch professor review
distributions.
*
[`src/graphql/queries/course/Course.tsx`](diffhunk://#diff-1891ac5315d683b28994d5b12b58d52653e74e145f8c4d04cf3c6d0047bae011R14-R21):
Updated course queries to include the new `CourseReviewDistribution`
fragment.
*
[`src/graphql/queries/prof/Prof.tsx`](diffhunk://#diff-44212a00a60bf50af66a44c9a43b571118b773a75a6c1da0b5240778f2d07d4fR11-R17):
Updated professor queries to include the new `ProfReviewDistribution`
fragment.

Enhancements to course page:

*
[`src/pages/coursePage/CourseInfoHeader.tsx`](diffhunk://#diff-9d318203c59eaa85e6ef87c657be2c0447bdd138802ee962257322e4ba97c3e4L22-R41):
Updated the `CourseInfoHeader` component to include rating distributions
in the props and display them using the new components.
*
[`src/pages/coursePage/CoursePage.tsx`](diffhunk://#diff-6d62b2250177bd8b0725027c7423e00205a750db580b9bc7a7fb03cfff02d802R76-R95):
Added logic to process and pass rating distribution data to the
`CourseInfoHeader` component
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