Rails 5.2: Arel.sql
Change-Id: Id322a92532b83ffa87f445002eeab918efb269b6 Reviewed-on: https://gerrit.instructure.com/159149 Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
3fa322b7e3
commit
efa79ff952
|
@ -50,7 +50,7 @@ class GradebookGradingPeriodAssignments
|
|||
where(enrollments: { course_id: @course, type: ['StudentEnrollment', 'StudentViewEnrollment'] }).
|
||||
where.not(grading_period_id: nil, enrollments: { workflow_state: excluded_workflow_states }).
|
||||
group(:grading_period_id).
|
||||
pluck(:grading_period_id, "array_agg(DISTINCT assignment_id)").
|
||||
pluck(:grading_period_id, Arel.sql("array_agg(DISTINCT assignment_id)")).
|
||||
to_h
|
||||
end
|
||||
end
|
||||
|
|
|
@ -331,11 +331,11 @@ class UserMerge
|
|||
|
||||
ContextModuleProgression.
|
||||
where(context_module_id: cmp.context_module_id, user_id: [from_user, target_user]).
|
||||
order("CASE WHEN workflow_state = 'completed' THEN 0
|
||||
WHEN workflow_state = 'started' THEN 1
|
||||
WHEN workflow_state = 'unlocked' THEN 2
|
||||
WHEN workflow_state = 'locked' THEN 3
|
||||
END DESC").first.destroy
|
||||
order(Arel.sql("CASE WHEN workflow_state = 'completed' THEN 0
|
||||
WHEN workflow_state = 'started' THEN 1
|
||||
WHEN workflow_state = 'unlocked' THEN 2
|
||||
WHEN workflow_state = 'locked' THEN 3
|
||||
END DESC")).first.destroy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue