mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-27 20:38:48 +01:00
#1153: Use translations properly, add missing labels, fix bugs and add links to charts
This commit is contained in:
parent
0a106aac5e
commit
0b326e17d8
4 changed files with 160 additions and 75 deletions
|
|
@ -44,13 +44,6 @@ class StatsController < ApplicationController
|
|||
render :layout => false
|
||||
end
|
||||
|
||||
def context_running_actions_data
|
||||
actions = Stats::TopContextsQuery.new(current_user, :running => true).result
|
||||
@data = Stats::PieChartData.new(actions, t('stats.spread_of_running_actions_for_visible_contexts'), 60)
|
||||
|
||||
render :pie_chart_data, :layout => false
|
||||
end
|
||||
|
||||
def show_selected_actions_from_chart
|
||||
@page_title = t('stats.action_selection_title')
|
||||
@count = 99
|
||||
|
|
@ -170,4 +163,14 @@ class StatsController < ApplicationController
|
|||
def put_events_into_month_buckets(records, array_size, date_method_on_todo)
|
||||
convert_to_array(records.select { |x| x.send(date_method_on_todo) }, array_size) { |r| [difference_in_months(@today, r.send(date_method_on_todo))]}
|
||||
end
|
||||
|
||||
# assumes date1 > date2
|
||||
def difference_in_days(date1, date2)
|
||||
return ((date1.utc.at_midnight-date2.utc.at_midnight)/SECONDS_PER_DAY).to_i
|
||||
end
|
||||
|
||||
# assumes date1 > date2
|
||||
def difference_in_weeks(date1, date2)
|
||||
return difference_in_days(date1, date2) / 7
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue