Skip to content

Commit

Permalink
Fix minor bug in UpdateTimeslicesCourseWiki when start date changes a…
Browse files Browse the repository at this point in the history
…nd there is no timeslice for the start ingestion date (#6188)
  • Loading branch information
gabina authored Feb 10, 2025
1 parent e133aef commit db4cf74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/services/update_timeslices_course_wiki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def update_timeslices_durations
@course.wikis.each do |wiki|
start = @timeslice_manager.get_ingestion_start_time_for_wiki wiki
timeslice = @course.course_wiki_timeslices.where(wiki:, start:).first
next unless timeslice
effective_timeslice_duration = timeslice.end - timeslice.start
real_timeslice_duration = @timeslice_manager.timeslice_duration(wiki)
# Continue if timeslice duration didn't change for the wiki
Expand Down
6 changes: 6 additions & 0 deletions spec/services/update_timeslices_course_wiki_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@
expect(last_timeslice.end - last_timeslice.start).to eq(172800)
end
end

it 'doesnt fail if there are no timeslices for the ingestion start date' do
manager.create_timeslices_for_new_course_wiki_records([enwiki])
course.update(start: '2018-11-20')
described_class.new(course).run
end
end

0 comments on commit db4cf74

Please sign in to comment.