don't include rejected teachers in account course list
test plan: * create a course and invite a teacher * reject the invitation * the rejected user should not show in the list of "Teachers" on the account-level course list closes #CNVS-36830 Change-Id: I1ced8d37631aed1208c4781507abb090b3290443 Reviewed-on: https://gerrit.instructure.com/111472 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: David Tan <dtan@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
eac1175f84
commit
0b1d1a3e31
|
@ -1007,7 +1007,7 @@ class AccountsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
teachers = TeacherEnrollment.for_courses_with_user_name(courses_to_fetch_users_for).admin.active
|
||||
teachers = TeacherEnrollment.for_courses_with_user_name(courses_to_fetch_users_for).admin.where.not(:enrollments => {:workflow_state => %w{rejected deleted}})
|
||||
course_to_student_counts = StudentEnrollment.student_in_claimed_or_available.where(:course_id => courses_to_fetch_users_for).group(:course_id).distinct.count(:user_id)
|
||||
courses_to_teachers = teachers.inject({}) do |result, teacher|
|
||||
result[teacher.course_id] ||= []
|
||||
|
|
|
@ -244,6 +244,18 @@ describe AccountsController do
|
|||
|
||||
end
|
||||
|
||||
it "should not list rejected teachers" do
|
||||
account_with_admin_logged_in
|
||||
course_with_teacher(:account => @account)
|
||||
@teacher2 = User.create(:name => "rejected")
|
||||
reject = @course.enroll_user(@teacher2, "TeacherEnrollment")
|
||||
reject.reject!
|
||||
|
||||
get 'show', :id => @account.id, :format => 'html'
|
||||
|
||||
expect(assigns[:courses].find {|c| c.id == @course.id }.teacher_names).to eq [@teacher.name]
|
||||
end
|
||||
|
||||
it "should sort courses as specified" do
|
||||
account_with_admin_logged_in(account: @account)
|
||||
course_with_teacher(:account => @account)
|
||||
|
|
Loading…
Reference in New Issue