Skip to content

Commit 41bff45

Browse files
committed
ensure an assignment group exists when editing assignment
this manifested itself in a bunch of tickets from pcsd Change-Id: I86a23cde6e1e55a8251124677bb0e66a2bd0cd92 Reviewed-on: https://gerrit.instructure.com/5170 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Hudson <hudson@instructure.com>
1 parent 1b2e96d commit 41bff45

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

app/controllers/assignments_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def show
6060
return
6161
end
6262
if authorized_action(@assignment, @current_user, :read)
63+
@context.require_assignment_group
6364
@assignment_groups = @context.assignment_groups.active
6465
if !@assignment.new_record? && !@assignment_groups.map(&:id).include?(@assignment.assignment_group_id)
6566
@assignment.assignment_group = @assignment_groups.first

spec/controllers/assignments_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def course_assignment
106106
a = @course.assignments.create(:title => "some assignment")
107107

108108
get 'show', :course_id => @course.id, :id => a.id
109-
assigns[:assignment_groups].should_not be_nil
109+
assigns[:assignment_groups].should_not be_blank
110110
assigns[:unlocked].should_not be_nil
111111
end
112112

0 commit comments

Comments
 (0)