From f58d76c5ef8fe331986750e8b6e14866c6f0cb97 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 16 Aug 2018 14:30:49 -0400 Subject: [PATCH] prevent from grabbing length from stats format --- app/controllers/rooms_controller.rb | 7 ++++++- app/views/shared/components/_public_recording_row.html.erb | 2 +- app/views/shared/components/_recording_row.html.erb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) 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]) %>