Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/crowd-sourced-data'…
Browse files Browse the repository at this point in the history
… into crowd-sourced-data
  • Loading branch information
mathhulk committed Oct 30, 2024
2 parents 9888104 + 35a49ee commit 8938ca8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions apps/backend/src/modules/rating/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import {
Rating,
AggregatedRatings,
Metric,
Category
} from './typedefs/rating';
Category,
Semester
} from '../../generated-types/graphql';
// mongo -> graphql (models -> typedefs)

export const formatUserRating = (rating: RatingType): Rating => ({
subject: rating.subject,
courseNumber: rating.courseNumber,
semester: rating.semester,
semester: rating.semester as Semester,
year: rating.year,
class: rating.class,

Expand All @@ -22,7 +23,7 @@ export const formatUserRating = (rating: RatingType): Rating => ({

// does mongo always return an array? single return val vs multiple val
export const formatUserRatings = (ratings: any[]): Rating[] => {
return ratings.map(formatUserRatings);
return ratings.map(formatUserRating);
};

// grandparent group by class -> done
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/models/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ratingSchema = new Schema({
required: true,
},
year: {
type: String,
type: Number,
required: true,
},
class: {
Expand Down

0 comments on commit 8938ca8

Please sign in to comment.