mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-22 23:24:07 +01:00
use size in stead of count to prevent unnecessary querying
This commit is contained in:
parent
caec4f214a
commit
a987ff3727
5 changed files with 13 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<%-
|
||||
url_array = Array.new(13){ |i| url_for :controller => 'stats', :action => 'actions_done_last_years'}
|
||||
created_count_array = Array.new(13){ |i| @actions_created_last12months.count/12.0 }
|
||||
done_count_array = Array.new(13){ |i| @actions_done_last12months.count/12.0 }
|
||||
created_count_array = Array.new(13){ |i| @actions_created_last12months.size/12.0 }
|
||||
done_count_array = Array.new(13){ |i| @actions_done_last12months.size/12.0 }
|
||||
month_names = Array.new(13){ |i| t('date.month_names')[ (Time.now.mon - i -1 ) % 12 + 1 ]}
|
||||
-%>
|
||||
&title=<%= t('stats.actions_lastyear_title') %>,{font-size:16},&
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<%-
|
||||
created_count_array = Array.new(30){ |i| @actions_created_last30days.count/30.0 }
|
||||
done_count_array = Array.new(30){ |i| @actions_done_last30days.count/30.0 }
|
||||
created_count_array = Array.new(30){ |i| @actions_created_last30days.size/30.0 }
|
||||
done_count_array = Array.new(30){ |i| @actions_done_last30days.size/30.0 }
|
||||
# TODO: make the strftime i18n proof
|
||||
time_labels = Array.new(30){ |i| l(Time.zone.now-i.days, :format => :stats) }
|
||||
-%>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<%-
|
||||
created_count_array = Array.new(@month_count+1){ |i| @actions_created_last_months.count/@month_count }
|
||||
done_count_array = Array.new(@month_count+1){ |i| @actions_done_last_months.count/@month_count }
|
||||
created_count_array = Array.new(@month_count+1){ |i| @actions_created_last_months.size/@month_count }
|
||||
done_count_array = Array.new(@month_count+1){ |i| @actions_done_last_months.size/@month_count }
|
||||
month_names = Array.new(@month_count+1){ |i| t('date.month_names')[ (Time.now.mon - i -1 ) % 12 + 1 ]+ " " + (Time.now - i.months).year.to_s}
|
||||
-%>
|
||||
&title=<%= t('stats.actions_last_year') %>,{font-size:16},&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue