Only use course dates to determine soft-concluded state if set to override term dates
Fixes CNVS-6541 Test plan: - Create a course with a course end date in the past, but belonging to a current term - Verify course dates do not override term dates - Course should not be shown as soft-concluded -- (can be seen in /courses/:course_id/users, on the 'add people' button) Change-Id: I3c22b57192341977a3b9694af9b4c2ecda2be413 Reviewed-on: https://gerrit.instructure.com/39438 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Clare Strong <clare@instructure.com> Product-Review: Hilary Scharton <hilary@instructure.com>
This commit is contained in:
parent
625c22ecfd
commit
ef939ea5ad
|
@ -1189,7 +1189,7 @@ class Course < ActiveRecord::Base
|
|||
# Returns boolean or nil.
|
||||
def soft_concluded?
|
||||
now = Time.now
|
||||
return end_at < now if end_at
|
||||
return end_at < now if end_at && restrict_enrollments_to_course_dates
|
||||
enrollment_term.end_at && enrollment_term.end_at < now
|
||||
end
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ describe Course do
|
|||
|
||||
context "without term end date" do
|
||||
it "should know if it has been soft-concluded" do
|
||||
@course.update_attribute(:conclude_at, nil)
|
||||
@course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true })
|
||||
@course.should_not be_soft_concluded
|
||||
|
||||
@course.update_attribute(:conclude_at, 1.week.from_now)
|
||||
|
@ -70,7 +70,7 @@ describe Course do
|
|||
end
|
||||
|
||||
it "should know if it has been soft-concluded" do
|
||||
@course.update_attribute(:conclude_at, nil)
|
||||
@course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true })
|
||||
@course.should be_soft_concluded
|
||||
|
||||
@course.update_attribute(:conclude_at, 1.week.from_now)
|
||||
|
@ -87,7 +87,7 @@ describe Course do
|
|||
end
|
||||
|
||||
it "should know if it has been soft-concluded" do
|
||||
@course.update_attribute(:conclude_at, nil)
|
||||
@course.update_attributes({:conclude_at => nil, :restrict_enrollments_to_course_dates => true })
|
||||
@course.should_not be_soft_concluded
|
||||
|
||||
@course.update_attribute(:conclude_at, 1.week.from_now)
|
||||
|
@ -97,6 +97,23 @@ describe Course do
|
|||
@course.should be_soft_concluded
|
||||
end
|
||||
end
|
||||
|
||||
context "with coures dates not overriding term dates" do
|
||||
before do
|
||||
@course.update_attribute(:conclude_at, 1.week.from_now)
|
||||
end
|
||||
|
||||
it "should ignore course dates if not set to override term dates when calculating soft-concluded state" do
|
||||
@course.enrollment_term.update_attribute(:end_at, nil)
|
||||
@course.should_not be_soft_concluded
|
||||
|
||||
@course.enrollment_term.update_attribute(:end_at, 1.week.from_now)
|
||||
@course.should_not be_soft_concluded
|
||||
|
||||
@course.enrollment_term.update_attribute(:end_at, 1.week.ago)
|
||||
@course.should be_soft_concluded
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "allow_student_discussion_topics" do
|
||||
|
|
Loading…
Reference in New Issue