optimize a few potentially expensive checks in the course wizard
optimize a few potentially expensive checks in the course wizard

Doing something like:

  @context.attachments.active.empty?

can actually be expensive if there are a lot of attachments, since it does a
count and then compares that to 0. In this case, we don't actually need to do
a count, we just need to know if there's at least 1 of the item:

  @context.attachments.active.first.nil?

We may want to monkey patch the named_scope implementation of empty? to do
this.

Also, we probably shouldn't even bother rendering the course wizard content on
the page until it's requested, but that will be a more involved change.

test plan:
 * Make sure you can still load your course home page
 * Create a new course, and make sure the wizard's steps highlight properly,
   and then dim properly after you've completed the steps.

Change-Id: I0850f26d26f24cd39862877842f54b71fc9dcf47
Reviewed-on: https://gerrit.instructure.com/11699
Reviewed-by: Jon Jensen <44f878afe53efc66b76772bd845eb65944ed8232@instructure.com>
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>

utkarshx/canvas-lms,ankithbti/canvas_lms,djbender/canvas-lms,gbleydon/canvas-lms,jay3126/canvas-lms,AndranikMarkosyan/lms,arrivu/arrivu-lms,djbender/canvas-lms,tgroshon/canvas-lms,icelab/canvas,merichar/canvas-lms,eCNAP/CANVAS,AndranikMarkosyan/lms,eCNAP/CANVAS,arrivu/jigsaw-lms,matematikk-mooc/canvas-lms,utkarshx/canvas-lms,va7map/canvas-lms,dgynn/canvas-lms,kyroskoh/canvas-lms,sdeleon28/canvas-lms,sdeleon28/canvas-lms,landonwilkins/canvas-lms,instructure/canvas-lms,juoni/canvas-lms,shidao-fm/canvas-lms,dgynn/canvas-lms,Jyaasa/canvas-lms,snehakachroo1/LSI_replica,Rvor/canvas-lms,HotChalk/canvas-lms,va7map/canvas-lms,icelab/canvas,dgynn/canvas-lms,shidao-fm/canvas-lms,jay3126/canvas-lms,nditech/red-innovadores-lms,antoniuslin/canvas-lms,merichar/canvas-lms,sli7246/canvas_branch,usmschuck/canvas,instructure/canvas-lms,rup/Tarrax,Rvor/canvas-lms,usmschuck/canvas,whalejasmine/canvas-lms,kyroskoh/canvas-lms,Unow/canvas-lms,Unow/ins,loganrun/pincan,gbleydon/canvas-lms,ShreniiNepal/shrenii_lmp,AndranikMarkosyan/lms,wrdsb/canvas-lms,merichar/canvas-lms,skmezanul/canvas-lms,arrivu/hoodemo,arrivu/hiring-site,fronteerio/canvas-lms,arrivu/hiring-site,sfu/canvas-lms,HotChalk/canvas-lms,sfu/canvas-lms,loganrun/pincan,sfu/canvas-lms,ShreniiNepal/shrenii_lmp,samuels410/greatlakes-lms,eCNAP/CANVAS,wimemx/Canvas,wye0220/shindig-canvas,sfu/canvas-lms,ShreniiNepal/shrenii_lmp,grahamb/canvas-lms,shidao-fm/canvas-lms,wrdsb/canvas-lms,Unow/ins,instructure/canvas-lms,fronteerio/canvas-lms,Rvor/canvas-lms,parbros/red-innovadores-lms,redconfetti/canvas-lms,arrivu/qibla-ecampus,instructure/canvas-lms,nditech/red-innovadores-lms,juoni/canvas-lms,leftplusrightllc/canvas-lms,roxolan/canvas-lms,landonwilkins/canvas-lms,loganrun/pincan,tgroshon/canvas-lms,parbros/red-innovadores-lms,djbender/canvas-lms,efrj/canvas-lms,arrivu/qibla-ecampus,landonwilkins/canvas-lms,sli7246/canvas_branch,dgynn/canvas-lms,whalejasmine/canvas-lms,roxolan/canvas-lms,rup/Tarrax,greyhwndz/canvas-lms,sli7246/canvas_branch,wye0220/shindig-canvas,arrivu/hoodemo,matematikk-mooc/canvas-lms,kyroskoh/canvas-lms,venturehive/canvas-lms,usmschuck/canvas,arrivu/jigsaw-lms,SwinburneOnline/canvas-lms,usmschuck/canvas,narigone/canvas,Jyaasa/canvas-lms,grahamb/canvas-lms,venturehive/canvas-lms,wrdsb/canvas-lms,venturehive/canvas-lms,skmezanul/canvas-lms,narigone/canvas,arrivu/arrivu-lms,snehakachroo1/LSI_replica,juoni/canvas-lms,redconfetti/canvas-lms,whalejasmine/canvas-lms,HotChalk/canvas-lms,matematikk-mooc/canvas-lms,tgroshon/canvas-lms,arrivu/qibla-ecampus,greyhwndz/canvas-lms,instructure/canvas-lms,roxolan/canvas-lms,HotChalk/canvas-lms,nditech/red-innovadores-lms,wimemx/Canvas,Jyaasa/canvas-lms,Jyaasa/canvas-lms,leftplusrightllc/canvas-lms,djbender/canvas-lms,narigone/canvas,efrj/canvas-lms,kyroskoh/canvas-lms,antoniuslin/canvas-lms,nditech/red-innovadores-lms,jay3126/canvas-lms,grahamb/canvas-lms,SwinburneOnline/canvas-lms,tgroshon/canvas-lms,efrj/canvas-lms,efrj/canvas-lms,Unow/ins,ankithbti/canvas_lms,Rvor/canvas-lms,ShreniiNepal/shrenii_lmp,utkarshx/canvas-lms,narigone/canvas,va7map/canvas-lms,arrivu/hoodemo,utkarshx/canvas-lms,greyhwndz/canvas-lms,juoni/canvas-lms,arrivu/arrivu-lms,landonwilkins/canvas-lms,greyhwndz/canvas-lms,antoniuslin/canvas-lms,redconfetti/canvas-lms,venturehive/canvas-lms,sdeleon28/canvas-lms,icelab/canvas,skmezanul/canvas-lms,instructure/canvas-lms,fronteerio/canvas-lms,parbros/red-innovadores-lms,antoniuslin/canvas-lms,roxolan/canvas-lms,grahamb/canvas-lms,arrivu/jigsaw-lms,jay3126/canvas-lms,fronteerio/canvas-lms,Unow/canvas-lms,wrdsb/canvas-lms,SwinburneOnline/canvas-lms,sdeleon28/canvas-lms,sfu/canvas-lms,eCNAP/CANVAS,va7map/canvas-lms,sfu/canvas-lms,leftplusrightllc/canvas-lms,AndranikMarkosyan/lms,leftplusrightllc/canvas-lms,SwinburneOnline/canvas-lms,instructure/canvas-lms,matematikk-mooc/canvas-lms,snehakachroo1/LSI_replica,sfu/canvas-lms,samuels410/greatlakes-lms,rup/Tarrax,whalejasmine/canvas-lms,samuels410/greatlakes-lms,gbleydon/canvas-lms,redconfetti/canvas-lms,ankithbti/canvas_lms,wimemx/Canvas,Unow/canvas-lms,snehakachroo1/LSI_replica,shidao-fm/canvas-lms,grahamb/canvas-lms,wye0220/shindig-canvas,skmezanul/canvas-lms,arrivu/hiring-site,samuels410/greatlakes-lms