Use unordered Course.assessments to get categories #1962
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Course.assessment_categories needs to make sure that the associated .assessments do not have an .order scope attached
Summary
Summary generated by Reviewpad on 18 Aug 23 16:28 UTC
This pull request updates the
Course
model to use unorderedCourse.assessments
when retrieving categories for assessment categories. Specifically, theassessment_categories
method now usesassessments.unscope(:order)
instead ofassessments
to ensure that the associated assessments do not have anorder
scope attached.Description
Courses have an assessment_categories method that returns the list of categories for all the assessments in the course as a list of strings. It uses an ActiveRecord query with
distinct
to get this list.This change makes sure that there is no
ORDER BY
in the resulting query.Motivation and Context
If the database used by autolab is a mysql instance with ONLY_FULL_GROUP_BY enabled, the gradebook cannot be rendered unless this change is included (or the sql_mode is changed)
How Has This Been Tested?
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for lintingOther issues / help required