query the account's shard for enrollments in account policy block

refs CNVS-11420

Change-Id: Iedd7d6b97b19fa636d6cdd536ca7e5914ef12743
Reviewed-on: https://gerrit.instructure.com/31001
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2014-02-27 13:08:29 -07:00
parent d8f69471bb
commit 0b04882f17
1 changed files with 1 additions and 1 deletions

View File

@ -729,7 +729,7 @@ class Account < ActiveRecord::Base
result = false
if !site_admin? && user
scope = user.enrollments.where(:root_account_id => root_account).where("enrollments.workflow_state<>'deleted'")
scope = root_account.enrollments.active.where(user_id: user)
result = root_account.teachers_can_create_courses? &&
scope.where(:type => ['TeacherEnrollment', 'DesignerEnrollment']).exists?
result ||= root_account.students_can_create_courses? &&