include custom students in course group category lists

test plan:
 - create a custom student role
 - enroll one or more students in a course with this role
 - also enroll some normal students
 - go to the groups page, and create a group set
 - both normal students and custom students should show up
   in the "unassigned" list and be assignable to groups
 - if you divide students into groups automatically, both
   custom and normal students should be assigned

fixes CNVS-10434

Change-Id: Ib609af34063e10af605c8d8e11cde50d1fee967a
Reviewed-on: https://gerrit.instructure.com/29667
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
This commit is contained in:
Jeremy Stanley 2014-02-05 12:13:54 -07:00
parent 06bbebe78d
commit 407de588ba
2 changed files with 9 additions and 1 deletions

View File

@ -313,7 +313,7 @@ class GroupCategoriesController < ApplicationController
search_term = params[:search_term].presence
search_params = params.slice(:search_term)
search_params[:enrollment_role] = "StudentEnrollment" if @context.is_a? Course
search_params[:enrollment_type] = "student" if @context.is_a? Course
@group_category ||= @context.group_categories.find_by_id(params[:category_id])
exclude_groups = value_to_boolean(params[:unassigned]) ? @group_category.groups.active.pluck(:id) : []

View File

@ -129,6 +129,14 @@ describe "Group Categories API", type: :request do
@category_unassigned_users.map(&:id).should include(user['id'])
end
end
it "should include custom student roles in search" do
teacher = @user
custom_student = user(name: "blah")
@course.enroll_user(custom_student, 'StudentEnrollment', role_name: 'CustomStudent')
json = api_call_as_user(teacher, :get, api_url, api_route)
json.map{|u|u['id']}.should be_include custom_student.id
end
end
describe "teacher actions with no group" do