From bd3f40bac9279f6be72e0e052dcea514948d3abe Mon Sep 17 00:00:00 2001 From: farhatahmad Date: Wed, 11 Oct 2023 11:51:17 -0400 Subject: [PATCH] Fix issue with recording resync deleting recordings --- app/services/recording_creator.rb | 2 +- app/services/recordings_sync.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/services/recording_creator.rb b/app/services/recording_creator.rb index cde51b1376..569814f2b3 100644 --- a/app/services/recording_creator.rb +++ b/app/services/recording_creator.rb @@ -68,7 +68,7 @@ def get_recording_length(recording:) length = 0 if recording[:playback][:format].is_a?(Array) recording[:playback][:format].each do |formats| - length = formats[:length] if formats[:type] == 'presentation' + length = formats[:length] if formats[:type] == 'presentation' || formats[:type] == 'video' end else length = recording[:playback][:format][:length] diff --git a/app/services/recordings_sync.rb b/app/services/recordings_sync.rb index 7a96ac4c76..af50e10bdf 100644 --- a/app/services/recordings_sync.rb +++ b/app/services/recordings_sync.rb @@ -23,7 +23,9 @@ def initialize(room:, provider:) end def call - @room.recordings.destroy_all + recordings = @room.recordings + Format.where(recordings:).delete_all + recordings.delete_all recordings = BigBlueButtonApi.new(provider: @provider).get_recordings(meeting_ids: @room.meeting_id) recordings[:recordings].each do |recording|