Skip to content

Commit

Permalink
Code review done
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoriamr committed Feb 6, 2018
1 parent 5935e4f commit a8c2359
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
8 changes: 3 additions & 5 deletions app/assets/javascripts/app/manage/statistics.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ $ ->

if uri.indexOf("?") < 0
$('.starts-at-wrapper .btn.all').addClass("active")
$('.starts-at-wrapper .btn-group .btn.pick').removeClass("active")
else
$('.starts-at-wrapper .btn-group .btn').addClass("active")
$('.starts-at-wrapper .btn.all').removeClass("active")
$('.starts-at-wrapper .btn-group .btn.pick').addClass("active")

mconf.Resources.addToBind ->
mconf.StatisticsFilter.bind()
Expand All @@ -17,10 +19,6 @@ $ ->
$('.starts-at-wrapper .btn.all').on 'click', ->
window.location.replace(uri.substring(0, uri.indexOf("?")))

isAllSelected = ->
selected = $('.starts-at-wrapper .btn.all').data('attr-value')
selected is 0

filterByDate = (el) ->
if el
selected = $(el).data('attr-value')
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/app/manage/statistics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ body.manage.statistics {

.title {
font-size: 20px;
color: #004956;
color: $m-green-logo;
font-weight: bold;
margin: 8px 0;
}
Expand Down
8 changes: 4 additions & 4 deletions app/views/manage/_statistics_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
.text= t('.meetings.all', value: @statistics[:meetings][:all])

- total = @statistics[:meetings][:total]
- if total == 0
- if total.zero?
.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 = @statistics[:meetings][:average]
- if average == 0
- if average.zero?
.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))
Expand All @@ -38,13 +38,13 @@
.text= t('.recordings.all', value: @statistics[:recordings][:all])

- total = @statistics[:recordings][:total]
- if total == 0
- if total.zero?
.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 = @statistics[:recordings][:average]
- if average == 0
- if average.zero?
.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))
Expand Down
2 changes: 1 addition & 1 deletion app/views/manage/statistics.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
%input{ type: 'radio' }
= t('.all')

%label.btn.btn-default{ 'data-attr-value': '1' }
%label.btn.btn-default.pick{ 'data-attr-value': '1' }
%input{ type: 'radio' }
= link_to manage_statistics_filter_path, class: "open-modal tooltipped", title: t('.date') do
= icon_later
Expand Down
6 changes: 3 additions & 3 deletions lib/mconf/statistics_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def self.total_meetings(from, to)

meetings.find_each do |m|
# total duration
unless m.finish_time == nil
unless m.finish_time.blank?
duration = m.finish_time - m.create_time
end
total = total + duration
Expand All @@ -62,7 +62,7 @@ def self.total_meetings(from, to)

# duration average
result[:all] = count
if count == 0
if count.zero?
result[:average] = 0
else
result[:average] = total / count
Expand Down Expand Up @@ -94,7 +94,7 @@ def self.total_recordings(from, to)
# duration average
result[:all] = count
result[:size] = size
if count == 0
if count.zero?
result[:average] = 0
else
result[:average] = total / count
Expand Down

0 comments on commit a8c2359

Please sign in to comment.