Merge pull request #243 from joshua-arts/temp-stats-rec-fix

Fix error when loading recordings that contain "statistics" format.
This commit is contained in:
Joshua Arts 2018-08-16 14:39:58 -04:00 committed by GitHub
commit 4434c31fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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">