forked from External/greenlight
		
	Fixed recording duration
This commit is contained in:
		@@ -140,8 +140,14 @@ class @Recordings
 | 
				
			|||||||
      if !@owner
 | 
					      if !@owner
 | 
				
			||||||
        table_api.column(-1).visible(false)
 | 
					        table_api.column(-1).visible(false)
 | 
				
			||||||
      for recording in data.recordings
 | 
					      for recording in data.recordings
 | 
				
			||||||
        totalMinutes = Math.round((new Date(recording.end_time) - new Date(recording.start_time)) / 1000 / 60)
 | 
					        hours = Math.floor(recording.length/60)
 | 
				
			||||||
        recording.duration = totalMinutes
 | 
					        minutes = recording.length % 60
 | 
				
			||||||
 | 
					        recording.duration =  if minutes>=60
 | 
				
			||||||
 | 
					                                hours+"hours and "+minutes+" minutes"
 | 
				
			||||||
 | 
					                              else if minutes>1
 | 
				
			||||||
 | 
					                                minutes+" minutes"
 | 
				
			||||||
 | 
					                              else
 | 
				
			||||||
 | 
					                                "< 1 minute"
 | 
				
			||||||
      data.recordings.sort (a,b) ->
 | 
					      data.recordings.sort (a,b) ->
 | 
				
			||||||
        return new Date(b.start_time) - new Date(a.start_time)
 | 
					        return new Date(b.start_time) - new Date(a.start_time)
 | 
				
			||||||
      table_api.clear()
 | 
					      table_api.clear()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,7 +113,7 @@ module BbbApi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    res[:recordings].each do |recording|
 | 
					    res[:recordings].each do |recording|
 | 
				
			||||||
      pref_preview = {}
 | 
					      pref_preview = {}
 | 
				
			||||||
 | 
					      recording[:length] = recording[:playback][:format].is_a?(Hash) ? recording[:playback][:format][:length] : recording[:playback][:format].first[:length]
 | 
				
			||||||
      # create a playbacks attribute on recording for playback formats
 | 
					      # create a playbacks attribute on recording for playback formats
 | 
				
			||||||
      recording[:playbacks] = if !recording[:playback] || !recording[:playback][:format]
 | 
					      recording[:playbacks] = if !recording[:playback] || !recording[:playback][:format]
 | 
				
			||||||
        []
 | 
					        []
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,7 @@ json.recordings do
 | 
				
			|||||||
    json.start_time recording[:startTime]
 | 
					    json.start_time recording[:startTime]
 | 
				
			||||||
    json.end_time recording[:endTime]
 | 
					    json.end_time recording[:endTime]
 | 
				
			||||||
    json.published recording[:published]
 | 
					    json.published recording[:published]
 | 
				
			||||||
 | 
					    json.length recording[:length]
 | 
				
			||||||
    json.previews do
 | 
					    json.previews do
 | 
				
			||||||
      json.array!(recording[:previews]) do |preview|
 | 
					      json.array!(recording[:previews]) do |preview|
 | 
				
			||||||
        json.partial! 'preview', preview: preview
 | 
					        json.partial! 'preview', preview: preview
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user