Skip to content

Commit

Permalink
LTI-402: Display length of longest playback format (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariam05 authored Aug 7, 2024
1 parent 90c00d4 commit 9101a45
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/concerns/bbb_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@ def recording_length(playbacks)
valid_playbacks = playbacks.reject { |p| p[:type] == 'statistics' }
return '0 min' if valid_playbacks.empty?

len = valid_playbacks.first[:length]
# Extract lengths from each playback format
lengths = playbacks.map do |playback|
playback[:length] if playback.is_a?(Hash) && playback.key?(:length)
end.compact

len = lengths.max
if len > 60
"#{(len / 60).round} hrs"
elsif len.zero?
Expand Down

0 comments on commit 9101a45

Please sign in to comment.