-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review for #958, optimize queries and improve the design a bit
Removed all "for"s from the module Statistics, they would make things very slow for large amounts of data. Now all stats are filtered directly in the database with SQL. Also reviewed the views and improved the design a little, made it look more like the other pages.
- Loading branch information
Showing
12 changed files
with
193 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,92 @@ | ||
-# locals: | ||
.list-container.list-tablefied | ||
.resource-filter-with-text | ||
%div.table-wrapper | ||
|
||
.resource-filter-without-text | ||
.title= t('.users.title') | ||
.text= t('.users.all', value: @statistics[:users][:all]) | ||
.text= t('.users.approved', value: @statistics[:users][:approved]) | ||
.text= t('.users.not_approved', value: @statistics[:users][:not_approved]) | ||
.text= t('.users.disabled', value: @statistics[:users][:disabled]) | ||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.users.title') | ||
%tbody | ||
%tr | ||
%td= t('.users.all') | ||
%td= @statistics[:users][:count] | ||
%tr | ||
%td= t('.users.approved') | ||
%td= @statistics[:users][:approved] | ||
%tr | ||
%td= t('.users.not_approved') | ||
%td= @statistics[:users][:not_approved] | ||
%tr | ||
%td= t('.users.disabled') | ||
%td= @statistics[:users][:disabled] | ||
|
||
-#.list-container.list-tablefied | ||
.title= t('.spaces.title') | ||
.text= t('.spaces.all', value: @statistics[:spaces][:all]) | ||
.text= t('.spaces.private', value: @statistics[:spaces][:private]) | ||
.text= t('.spaces.public', value: @statistics[:spaces][:public]) | ||
.text= t('.spaces.disabled', value: @statistics[:spaces][:disabled]) | ||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.spaces.title') | ||
%tbody | ||
%tr | ||
%td= t('.spaces.all') | ||
%td= @statistics[:spaces][:count] | ||
%tr | ||
%td= t('.spaces.private') | ||
%td= @statistics[:spaces][:private] | ||
%tr | ||
%td= t('.spaces.public') | ||
%td= @statistics[:spaces][:public] | ||
%tr | ||
%td= t('.spaces.disabled') | ||
%td= @statistics[:spaces][:disabled] | ||
|
||
-#.list-container.list-tablefied | ||
.title= t('.meetings.title') | ||
.text= t('.meetings.all', value: @statistics[:meetings][:all]) | ||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.meetings.title') | ||
%tbody | ||
%tr | ||
%td= t('.meetings.all') | ||
%td= @statistics[:meetings][:count] | ||
%tr | ||
%td= t('.meetings.total') | ||
%td | ||
- total = @statistics[:meetings][:total_duration] | ||
- if total.zero? | ||
= total | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + total, include_seconds: false) | ||
%tr | ||
%td= t('.meetings.average') | ||
%td | ||
- average = @statistics[:meetings][:average_duration] | ||
- if average.zero? | ||
= average | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + average, include_seconds: false) | ||
|
||
- total = @statistics[:meetings][:total] | ||
- 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.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)) | ||
|
||
-#.list-container.list-tablefied | ||
.title= t('.recordings.title') | ||
.text= t('.recordings.all', value: @statistics[:recordings][:all]) | ||
|
||
- total = @statistics[:recordings][:total] | ||
- 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.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)) | ||
|
||
.text= t('.recordings.size', value: human_file_size(@statistics[:recordings][:size])) | ||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.recordings.title') | ||
%tbody | ||
%tr | ||
%td= t('.recordings.all') | ||
%td= @statistics[:recordings][:count] | ||
%tr | ||
%td= t('.recordings.total') | ||
%td | ||
- total = @statistics[:recordings][:total_duration] | ||
- if total.zero? | ||
= total | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + total, include_seconds: false) | ||
%tr | ||
%td= t('.recordings.average') | ||
%td | ||
- average = @statistics[:recordings][:average_duration] | ||
- if average.zero? | ||
= average | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + average, include_seconds: false) | ||
%tr | ||
%td= t('.recordings.size') | ||
%td= human_file_size(@statistics[:recordings][:size]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
#manage | ||
|
||
.modal-header | ||
#statistics-filters | ||
= simple_form_for :statistics, url: manage_statistics_path, html: { class: 'single-column' } do |f| | ||
.modal-body | ||
.row | ||
.col-xs-12.col-sm-9 | ||
.starts-at-wrapper | ||
.csv | ||
- starts = params[:statistics].present? ? params[:statistics][:starts_on_time] : nil | ||
- ends = params[:statistics].present? ? params[:statistics][:ends_on_time] : nil | ||
= link_to t('.csv'), manage_statistics_csv_path(format: :csv, statistics: { starts_on_time: starts, ends_on_time: ends }), class: 'btn btn-primary' | ||
.btn-group{ 'data-toggle': "buttons" } | ||
.csv | ||
- starts = params[:statistics].present? ? params[:statistics][:starts_on_time] : nil | ||
- ends = params[:statistics].present? ? params[:statistics][:ends_on_time] : nil | ||
= link_to t('.csv'), manage_statistics_csv_path(format: :csv, statistics: { starts_on_time: starts, ends_on_time: ends }), class: 'btn btn-primary' | ||
|
||
%label.btn.btn-default.all{ 'data-attr-value': '0' } | ||
%input{ type: 'radio' } | ||
= t('.all') | ||
.btn-group{ 'data-toggle': "buttons" } | ||
|
||
%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 | ||
= t('.date') | ||
= link_to manage_statistics_path, class: "btn btn-default all #{'active' unless params[:statistics].present?}" do | ||
= t('.all') | ||
= link_to manage_statistics_filter_path, class: "btn btn-default pick open-modal #{'active' if params[:statistics].present?}" do | ||
= icon_date | ||
= t('.date') | ||
|
||
#statistics-list | ||
#statistics-list{ 'data-filtered-by-date': params[:statistics].present?.to_s } | ||
= render partial: 'statistics_list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.