show groupless submissions in speedgrader
fixes CNVS-15753 Test plan: * make a group assignment with a group category that has no groups * submit some homework * the submissions should display (and be gradeable) in speedgrader * add some groups (with people in them) * submit more homework for the people with groups * the submissions for people in groups and people not in groups should all display * downloading submissions should work as well Change-Id: I7e6081cec61936c4f833394e995963698f4b57b7 Reviewed-on: https://gerrit.instructure.com/41596 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Matt Berns <mberns@instructure.com> Reviewed-by: Mike Nomitch <mnomitch@instructure.com> QA-Review: Sean Lewis <slewis@instructure.com> Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
parent
72e89eea45
commit
df6d8b969b
|
@ -1395,9 +1395,7 @@ class Assignment < ActiveRecord::Base
|
|||
else
|
||||
[]
|
||||
end
|
||||
group_category.groups.includes(:group_memberships => :user).map { |g|
|
||||
[g.name, g.users]
|
||||
}.map { |group_name, group_students|
|
||||
groups_and_ungrouped(user).map { |group_name, group_students|
|
||||
visible_group_students = group_students & visible_students_for_speed_grader(user)
|
||||
representative = (visible_group_students & users_with_turnitin_data).first
|
||||
representative ||= (visible_group_students & users_with_submissions).first
|
||||
|
@ -1419,6 +1417,17 @@ class Assignment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def groups_and_ungrouped(user)
|
||||
groups_and_users = group_category.
|
||||
groups.includes(:group_memberships => :user).
|
||||
map { |g| [g.name, g.users] }
|
||||
users_in_group = groups_and_users.flat_map { |_,users| users }
|
||||
groupless_users = visible_students_for_speed_grader(user) - users_in_group
|
||||
phony_groups = groupless_users.map { |u| [u.name, [u]] }
|
||||
groups_and_users + phony_groups
|
||||
end
|
||||
private :groups_and_ungrouped
|
||||
|
||||
# using this method instead of students_with_visibility so we
|
||||
# can add the includes and students_visible_to/participating_students scopes
|
||||
def visible_students_for_speed_grader(user)
|
||||
|
|
|
@ -2501,6 +2501,7 @@ describe Assignment do
|
|||
|
||||
context "group assignments" do
|
||||
before :once do
|
||||
course_with_teacher(active_all: true)
|
||||
gc = @course.group_categories.create! name: "Assignment Groups"
|
||||
@groups = 2.times.map { |i| gc.groups.create! name: "Group #{i}", context: @course }
|
||||
students = create_users_in_course(@course, 4, return_type: :record)
|
||||
|
@ -2551,6 +2552,11 @@ describe Assignment do
|
|||
s.update_attribute :submission_type, 'online_upload'
|
||||
@assignment.representatives(@teacher).should include g1rep
|
||||
end
|
||||
|
||||
it "includes users who aren't in a group" do
|
||||
student_in_course active_all: true
|
||||
@assignment.representatives(@teacher).last.should == @student
|
||||
end
|
||||
end
|
||||
|
||||
context "quizzes" do
|
||||
|
|
Loading…
Reference in New Issue