From 1f2ef10da6b596aa49f7ba339fc598168340d15d Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Mon, 6 Sep 2021 14:58:41 -0400 Subject: [PATCH] Fixed issue with All Recordings not returning all recordings if user has too many rooms (#2896) --- app/controllers/concerns/populator.rb | 7 ++++--- app/controllers/concerns/recorder.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/populator.rb b/app/controllers/concerns/populator.rb index dd86d314..b3ee7293 100644 --- a/app/controllers/concerns/populator.rb +++ b/app/controllers/concerns/populator.rb @@ -90,7 +90,8 @@ module Populator # Returns exactly 1 page of the latest recordings def latest_recordings - return_length = Rails.configuration.pagination_number + return_length = Rails.configuration.pagination_rows + number_of_rooms = Rails.configuration.pagination_number recordings = [] counter = 0 @@ -100,8 +101,8 @@ module Populator Room.includes(:owner) .where(users: { provider: @user_domain }) .order(last_session: :desc) - .limit(return_length) - .offset(counter * return_length) + .limit(number_of_rooms) + .offset(counter * number_of_rooms) .pluck(:bbb_id) else Room.order(last_session: :desc) diff --git a/app/controllers/concerns/recorder.rb b/app/controllers/concerns/recorder.rb index 0365fb2d..68607977 100644 --- a/app/controllers/concerns/recorder.rb +++ b/app/controllers/concerns/recorder.rb @@ -37,7 +37,7 @@ module Recorder def all_recordings(room_bbb_ids, search_params = {}, ret_search_params = false, search_name = false) res = { recordings: [] } - until room_bbb_ids.empty? || res[:recordings].length > Rails.configuration.pagination_number + until room_bbb_ids.empty? # bbb.get_recordings returns an object # take only the array portion of the object that is returned full_res = get_multiple_recordings(room_bbb_ids.pop(Rails.configuration.pagination_number))