diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 04f634d1..5a0ba720 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -130,7 +130,12 @@ class RoomsController < ApplicationController helper_method :recording_date # Helper for converting BigBlueButton dates into a nice length string. - def recording_length(len) + def recording_length(playbacks) + # Stats format currently doesn't support length. + playbacks.reject! { |p| p[:type] == "statistics" } + return "0 min" if playbacks.empty? + + len = playbacks.first[:length] if len > 60 "#{(len / 60).round} hrs" elsif len == 0 diff --git a/app/views/shared/components/_public_recording_row.html.erb b/app/views/shared/components/_public_recording_row.html.erb index eb8b6bf6..aefe96e6 100644 --- a/app/views/shared/components/_public_recording_row.html.erb +++ b/app/views/shared/components/_public_recording_row.html.erb @@ -32,7 +32,7 @@
<%= t("recording.table.length") %>
- <%= recording_length(recording[:playbacks].first[:length]) %> + <%= recording_length(recording[:playbacks]) %>
diff --git a/app/views/shared/components/_recording_row.html.erb b/app/views/shared/components/_recording_row.html.erb index 7b62d734..8b573a87 100644 --- a/app/views/shared/components/_recording_row.html.erb +++ b/app/views/shared/components/_recording_row.html.erb @@ -32,7 +32,7 @@
<%= t("recording.table.length") %>
- <%= recording_length(recording[:playbacks].first[:length]) %> + <%= recording_length(recording[:playbacks]) %>