Skip to content
New issue

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

Use unordered Course.assessments to get categories #1962

Merged
merged 1 commit into from
Aug 20, 2023

Conversation

cg2v
Copy link
Member

@cg2v cg2v commented Aug 18, 2023

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 unordered Course.assessments when retrieving categories for assessment categories. Specifically, the assessment_categories method now uses assessments.unscope(:order) instead of assessments to ensure that the associated assessments do not have an order 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

Other issues / help required

Course.assessment_categories needs to make sure that the associated
.assessments do not have an .order scope attached
@reviewpad reviewpad bot requested a review from 20wildmanj August 18, 2023 16:28
@reviewpad reviewpad bot added small Pull request is small waiting-for-review labels Aug 18, 2023
Copy link
Contributor

@20wildmanj 20wildmanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@20wildmanj 20wildmanj added this pull request to the merge queue Aug 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2023
@cg2v cg2v added this pull request to the merge queue Aug 20, 2023
Merged via the queue into autolab:master with commit 286fb0a Aug 20, 2023
@cg2v cg2v deleted the unscope_categories branch August 20, 2023 02:05
NicholasMy pushed a commit to UB-CSE-IT/Autolab that referenced this pull request Jan 4, 2024
Course.assessment_categories needs to make sure that the associated
.assessments do not have an .order scope attached

(cherry picked from commit 286fb0a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
small Pull request is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants