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>
This commit is contained in:
Ryan Shaw 2011-08-19 17:04:56 -06:00
parent 1b2e96d5ef
commit 41bff4537a
2 changed files with 2 additions and 1 deletions

View File

@ -60,6 +60,7 @@ class AssignmentsController < ApplicationController
return
end
if authorized_action(@assignment, @current_user, :read)
@context.require_assignment_group
@assignment_groups = @context.assignment_groups.active
if !@assignment.new_record? && !@assignment_groups.map(&:id).include?(@assignment.assignment_group_id)
@assignment.assignment_group = @assignment_groups.first

View File

@ -106,7 +106,7 @@ describe AssignmentsController do
a = @course.assignments.create(:title => "some assignment")
get 'show', :course_id => @course.id, :id => a.id
assigns[:assignment_groups].should_not be_nil
assigns[:assignment_groups].should_not be_blank
assigns[:unlocked].should_not be_nil
end