We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
Bug occurs only on production and is not replicated in local dev envs
Sorry, something went wrong.
Query in question
` export function generateBaseCourseAverages(qb: Knex.QueryBuilder, count: number = 3) {
return qb.with("CourseReview", (qb) => { qb.from("Review") .where( { "Review.deleted": false, "Review.archived": false }) .select(reviewInfo) }) .with("CourseAliases", (qb) => { qb.from("Course") .joinRaw("LEFT JOIN \"Alias\" ON \"Alias\".\"aliasID\" = \"Course\".\"courseID\"") .select({ courseID: "Course.courseID", primaryCourseID: knex.raw("COALESCE(\"Alias\".\"courseID\", \"Course\".\"courseID\")"), }); }) .from("CourseReview") .leftJoin("CourseAliases", "CourseAliases.courseID", "CourseReview.courseID") .groupBy("primaryCourseID") .havingRaw(`count(*) >= ?`, [count]) .select(["primaryCourseID as courseID"]) .avg({ /* Instructor specific */ avgInstructorEffectiveness: "CourseReview.instructorEffectiveness", avgInstructorAccommodationLevel: "CourseReview.instructorAccommodationLevel", avgInstructorEnthusiasm: "CourseReview.instructorEnthusiasm", avgInstructorAgain: knex.raw(`CAST("CourseReview"."instructorAgain" = 'True' as int)`), avgInstructorEnjoyed: knex.raw(`CAST("CourseReview"."instructorEnjoyed" = 'True' as int)`), /* Course specific */ avgRating: "CourseReview.rating", avgValue: "CourseReview.value", avgDifficulty: "CourseReview.difficulty", avgHours: "CourseReview.hours", avgAgain: knex.raw(`CAST("CourseReview"."again" = 'True' as int)`), // topTags: knex.raw(`array_agg(DISTINCT(UNNEST("CourseReview"."tags")))`) }) .count({ numReviews: "CourseReview.reviewID" });
} `
No branches or pull requests
The text was updated successfully, but these errors were encountered: