Skip to content

Refactor: Course Statistics #982

@artiehumphreys

Description

@artiehumphreys

Issue:

A course's average data (gpa, enjoyability, etc.) should NOT be fetched on the fly. It needs to be stored within the course model itself, given an instructor and course. We can update these averages on the fly via the following calculation whenever a review is added:

let n = num_of_reviews
let avg = avg_of_some_field
avg += inputted_value / n
avg /= (n + 1)
avg *= n

This will allow us to not have to fetch reviews every time we need to display that data on the department page, course instructor page, or otherwise.

Metadata

Metadata

Labels

RefactoringPurely internal changes for maintainability

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions