don't include concluded course groups in calendar
test plan: * create a course with a group * soft-conclude the course * as a user of that group, should not continue to see the group calendar on the calendar page fixes #CNVS-2776 Change-Id: Ie1c7ad722ced6bfb95a65c31faccfc989328ce18 Reviewed-on: https://gerrit.instructure.com/20394 Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Jeremy Putnam <jeremyp@instructure.com>
This commit is contained in:
parent
153cdc9c73
commit
748a26b566
|
@ -447,7 +447,8 @@ class ApplicationController < ActionController::Base
|
|||
# the grants_right? check to avoid querying for the various memberships
|
||||
# again.
|
||||
courses = @context.current_enrollments.with_each_shard.select { |e| e.state_based_on_date == :active }.map(&:course).uniq
|
||||
groups = include_groups ? @context.current_groups.with_each_shard : []
|
||||
groups = include_groups ? @context.current_groups.with_each_shard.reject{|g| g.context_type == "Course" &&
|
||||
(g.context.completed? || g.context.soft_concluded?)} : []
|
||||
if only_contexts.present?
|
||||
# find only those courses and groups passed in the only_contexts
|
||||
# parameter, but still scoped by user so we know they have rights to
|
||||
|
|
|
@ -74,6 +74,29 @@ describe CalendarsController do
|
|||
assigns[:contexts][1].should eql(@course)
|
||||
end
|
||||
|
||||
it "should retrieve unconcluded course groups for user" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
group_with_user(:group_context => @course, :user => @user, :active_all => true)
|
||||
group1 = @group
|
||||
|
||||
course_with_student_logged_in(:active_all => true, :user => @user)
|
||||
group_with_user(:group_context => @course, :user => @user, :active_all => true)
|
||||
group2 = @group
|
||||
@course.update_attribute(:conclude_at, Time.now - 1.week)
|
||||
|
||||
course_with_student_logged_in(:active_all => true, :user => @user)
|
||||
group_with_user(:group_context => @course, :user => @user, :active_all => true)
|
||||
group3 = @group
|
||||
@course.update_attribute('workflow_state', 'completed')
|
||||
|
||||
get 'show', :user_id => @user.id, :include_undated => true
|
||||
response.should be_success
|
||||
|
||||
assigns[:contexts].should include(group1)
|
||||
assigns[:contexts].should_not include(group2)
|
||||
assigns[:contexts].should_not include(group3)
|
||||
end
|
||||
|
||||
it "should retrieve events for a given month and year" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
e1 = course_event("Jan 1 2008")
|
||||
|
|
Loading…
Reference in New Issue