Skip to content

Commit

Permalink
new condition to show total and average of meetings and recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoriamr committed Jan 18, 2018
1 parent 733545b commit beebbd5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
29 changes: 25 additions & 4 deletions app/views/manage/_statistics_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,33 @@
-#.list-container.list-tablefied
.title= t('.meetings.title')
.text= t('.meetings.all', value: @data[:meetings][:all])
.text= t('.meetings.total', value: distance_of_time_in_words_to_now(Time.now + @data[:meetings][:total], include_seconds: false))
.text= t('.meetings.average', value: distance_of_time_in_words_to_now(Time.now + @data[:meetings][:average], include_seconds: false))

- total = @data[:meetings][:total]
- if total == 0
.text= t('.meetings.total', value: total)
- else
.text= t('.meetings.total', value: distance_of_time_in_words_to_now(Time.now + total, include_seconds: false))

- average = @data[:meetings][:average]
- if average == 0
.text= t('.meetings.average', value: average)
- else
.text= t('.meetings.average', value: distance_of_time_in_words_to_now(Time.now + average, include_seconds: false))

-#.list-container.list-tablefied
.title= t('.recordings.title')
.text= t('.recordings.all', value: @data[:recordings][:all])
.text= t('.recordings.total', value: distance_of_time_in_words_to_now(Time.now + @data[:recordings][:total], include_seconds: false))
.text= t('.recordings.average', value: distance_of_time_in_words_to_now(Time.now + @data[:recordings][:average], include_seconds: false))

- total = @data[:recordings][:total]
- if total == 0
.text= t('.recordings.total', value: total)
- else
.text= t('.recordings.total', value: distance_of_time_in_words_to_now(Time.now + total, include_seconds: false))

- average = @data[:recordings][:average]
- if average == 0
.text= t('.recordings.average', value: average)
- else
.text= t('.recordings.average', value: distance_of_time_in_words_to_now(Time.now + average, include_seconds: false))

.text= t('.recordings.size', value: human_file_size(@data[:recordings][:size]))
16 changes: 9 additions & 7 deletions lib/mconf/statistics_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ def self.total_meetings(from, to)
average = 0
count = 0

meetings.find_each do |m|
# total duration
unless m.finish_time == nil
duration = m.finish_time - m.create_time
end
total = total + duration
count = count + 1
unless meetings == 0
meetings.find_each do |m|
# total duration
unless m.finish_time == nil
duration = m.finish_time - m.create_time
end
total = total + duration
count = count + 1
end
end

# duration average
Expand Down

0 comments on commit beebbd5

Please sign in to comment.