prevent from grabbing length from stats format

This commit is contained in:
Joshua Arts 2018-08-16 14:30:49 -04:00
parent efc2e3ab17
commit f58d76c5ef
3 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -32,7 +32,7 @@
<div class="small text-muted text-uppercase">
<%= t("recording.table.length") %>
</div>
<%= recording_length(recording[:playbacks].first[:length]) %>
<%= recording_length(recording[:playbacks]) %>
</td>
<td class="text-left">
<div class="small text-muted text-uppercase">

View File

@ -32,7 +32,7 @@
<div class="small text-muted text-uppercase">
<%= t("recording.table.length") %>
</div>
<%= recording_length(recording[:playbacks].first[:length]) %>
<%= recording_length(recording[:playbacks]) %>
</td>
<td class="text-left">
<div class="small text-muted text-uppercase">