fix bad sql in refactored named scope
fix bad sql in refactored named scope

Change-Id: I6860fcb44c55e63cb84283061dd6c66582b72c8a
Reviewed-on: https://gerrit.instructure.com/18115
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>
Reviewed-by: Zach Pendleton <514dbb4d54d4f29e454990df7d075678f43f92aa@instructure.com>
QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>

wrdsb/canvas-lms,Unow/ins,usmschuck/canvas,wrdsb/canvas-lms,kyroskoh/canvas-lms,HotChalk/canvas-lms,sdeleon28/canvas-lms,juoni/canvas-lms,HotChalk/canvas-lms,samuels410/greatlakes-lms,whalejasmine/canvas-lms,sdeleon28/canvas-lms,venturehive/canvas-lms,redconfetti/canvas-lms,wimemx/Canvas,loganrun/pincan,SwinburneOnline/canvas-lms,sli7246/canvas_branch,venturehive/canvas-lms,redconfetti/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,wrdsb/canvas-lms,rup/Tarrax,va7map/canvas-lms,grahamb/canvas-lms,arrivu/hoodemo,samuels410/greatlakes-lms,tgroshon/canvas-lms,arrivu/arrivu-lms,leftplusrightllc/canvas-lms,wimemx/Canvas,Rvor/canvas-lms,grahamb/canvas-lms,sli7246/canvas_branch,arrivu/jigsaw-lms,sdeleon28/canvas-lms,juoni/canvas-lms,roxolan/canvas-lms,Rvor/canvas-lms,kyroskoh/canvas-lms,landonwilkins/canvas-lms,arrivu/jigsaw-lms,arrivu/qibla-ecampus,samuels410/greatlakes-lms,landonwilkins/canvas-lms,grahamb/canvas-lms,fronteerio/canvas-lms,utkarshx/canvas-lms,roxolan/canvas-lms,arrivu/jigsaw-lms,arrivu/qibla-ecampus,Jyaasa/canvas-lms,rup/Tarrax,shidao-fm/canvas-lms,va7map/canvas-lms,efrj/canvas-lms,landonwilkins/canvas-lms,antoniuslin/canvas-lms,skmezanul/canvas-lms,Unow/ins,arrivu/hoodemo,juoni/canvas-lms,wye0220/shindig-canvas,Unow/canvas-lms,loganrun/pincan,wye0220/shindig-canvas,greyhwndz/canvas-lms,usmschuck/canvas,efrj/canvas-lms,ShreniiNepal/shrenii_lmp,arrivu/hoodemo,djbender/canvas-lms,ShreniiNepal/shrenii_lmp,arrivu/arrivu-lms,sfu/canvas-lms,whalejasmine/canvas-lms,jay3126/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,Unow/canvas-lms,samuels410/greatlakes-lms,wye0220/shindig-canvas,venturehive/canvas-lms,fronteerio/canvas-lms,leftplusrightllc/canvas-lms,SwinburneOnline/canvas-lms,Unow/canvas-lms,utkarshx/canvas-lms,va7map/canvas-lms,antoniuslin/canvas-lms,Unow/ins,redconfetti/canvas-lms,redconfetti/canvas-lms,skmezanul/canvas-lms,va7map/canvas-lms,djbender/canvas-lms,wrdsb/canvas-lms,jay3126/canvas-lms,Jyaasa/canvas-lms,djbender/canvas-lms,venturehive/canvas-lms,leftplusrightllc/canvas-lms,antoniuslin/canvas-lms,leftplusrightllc/canvas-lms,efrj/canvas-lms,shidao-fm/canvas-lms,sfu/canvas-lms,SwinburneOnline/canvas-lms,sfu/canvas-lms,Jyaasa/canvas-lms,greyhwndz/canvas-lms,skmezanul/canvas-lms,wimemx/Canvas,greyhwndz/canvas-lms,tgroshon/canvas-lms,Jyaasa/canvas-lms,rup/Tarrax,HotChalk/canvas-lms,utkarshx/canvas-lms,merichar/canvas-lms,sfu/canvas-lms,greyhwndz/canvas-lms,HotChalk/canvas-lms,efrj/canvas-lms,juoni/canvas-lms,djbender/canvas-lms,Rvor/canvas-lms,grahamb/canvas-lms,landonwilkins/canvas-lms,whalejasmine/canvas-lms,ShreniiNepal/shrenii_lmp,shidao-fm/canvas-lms,fronteerio/canvas-lms,usmschuck/canvas,whalejasmine/canvas-lms,arrivu/arrivu-lms,Rvor/canvas-lms,usmschuck/canvas,ShreniiNepal/shrenii_lmp,jay3126/canvas-lms,shidao-fm/canvas-lms,tgroshon/canvas-lms,arrivu/qibla-ecampus,sdeleon28/canvas-lms,kyroskoh/canvas-lms,loganrun/pincan,merichar/canvas-lms,kyroskoh/canvas-lms,fronteerio/canvas-lms,sfu/canvas-lms,sli7246/canvas_branch,SwinburneOnline/canvas-lms,tgroshon/canvas-lms,skmezanul/canvas-lms,utkarshx/canvas-lms,grahamb/canvas-lms,antoniuslin/canvas-lms,merichar/canvas-lms,jay3126/canvas-lms