Show calendar events that used to be section-specific on planner

fixes LA-318
flag=none

Test plan
- Create a calendar event that has different dates per
  section
- (It should show up on planner at this point)
- Change it back to not being section specific
  and ensure it shows up on planner still

Change-Id: Ic212dc3ecd0517a7ee470c8431d1024ca5f093c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/219137
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
This commit is contained in:
Mysti Lilla 2019-12-02 14:05:13 -07:00
parent 21dc0e7293
commit c3dc354372
2 changed files with 16 additions and 3 deletions

View File

@ -164,9 +164,14 @@ class CalendarEvent < ActiveRecord::Base
SQL
}
scope :not_hidden, -> {
where("NOT EXISTS (SELECT id FROM #{CalendarEvent.quoted_table_name} sub_events WHERE sub_events.parent_calendar_event_id=calendar_events.id)")
}
scope :not_hidden, -> do
where("NOT EXISTS (
SELECT id
FROM #{CalendarEvent.quoted_table_name} sub_events
WHERE sub_events.parent_calendar_event_id=calendar_events.id
AND sub_events.workflow_state <> 'deleted'
)")
end
scope :undated, -> { where(:start_at => nil, :end_at => nil) }

View File

@ -155,6 +155,14 @@ describe PlannerController do
my_event_id = @course.default_section.calendar_events.where(parent_calendar_event_id: event).pluck(:id).first
expect(event_ids).not_to include event.id
expect(event_ids).to include my_event_id
event.update_attributes(remove_child_events: true)
get :index
json = json_parse(response.body)
event_ids = json.select { |thing| thing['plannable_type'] == 'calendar_event' }.map { |thing| thing['plannable_id'] }
expect(event_ids).to include event.id
expect(event_ids).not_to include my_event_id
end
it "should show appointment group reservations" do