diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index b92e7287..7d1dcdcd 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -78,8 +78,8 @@ class StatsController < ApplicationController def actions_done_last30days_data # get actions created and completed in the past 30 days. - @actions_done_last30days = current_user.todos.completed_after(@cut_off_month).select("completed_at") - @actions_created_last30days = current_user.todos.created_after(@cut_off_month).select("created_at") + @actions_done_last30days = current_user.todos.completed_after(@cut_off_30days).select("completed_at") + @actions_created_last30days = current_user.todos.created_after(@cut_off_30days).select("created_at") # convert to array. 30+1 to have 30 complete days and one current day [0] @actions_done_last30days_array = convert_to_days_from_today_array(@actions_done_last30days, 31, :completed_at) @@ -351,6 +351,7 @@ class StatsController < ApplicationController @cut_off_year = 12.months.ago.beginning_of_day @cut_off_year_plus3 = 15.months.ago.beginning_of_day @cut_off_month = 1.month.ago.beginning_of_day + @cut_off_30days = 30.days.ago.beginning_of_day end def get_ids_from (actions, week_from, week_to, at_end) diff --git a/app/views/stats/actions_done_last12months_data.html.erb b/app/views/stats/actions_done_last12months_data.html.erb index 8c681971..2fc2469b 100755 --- a/app/views/stats/actions_done_last12months_data.html.erb +++ b/app/views/stats/actions_done_last12months_data.html.erb @@ -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},& diff --git a/app/views/stats/actions_done_last30days_data.html.erb b/app/views/stats/actions_done_last30days_data.html.erb index 3b7cc813..11991146 100755 --- a/app/views/stats/actions_done_last30days_data.html.erb +++ b/app/views/stats/actions_done_last30days_data.html.erb @@ -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) } -%> diff --git a/app/views/stats/actions_done_lastyears_data.html.erb b/app/views/stats/actions_done_lastyears_data.html.erb index ae07bc36..a155bf64 100644 --- a/app/views/stats/actions_done_lastyears_data.html.erb +++ b/app/views/stats/actions_done_lastyears_data.html.erb @@ -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},& diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb index a9a891d4..14717e52 100644 --- a/features/step_definitions/container_steps.rb +++ b/features/step_definitions/container_steps.rb @@ -37,6 +37,10 @@ Then /^I should (see|not see) "([^"]*)" in the context container for "([^"]*)"$/ check_xpath_visibility(visible, todo_in_context_container_xpath(find_todo(todo_description), find_context(context_name))) end +Then(/^I should (see|not see) "([^"]*)" in the context container of "([^"]*)"$/) do |visible, todo_description, context_name| + step "I should #{visible} \"#{todo_description}\" in the context container for \"#{context_name}\"" +end + Then /^I should (see|not see) "([^"]*)" in the container for context "([^"]*)"$/ do |visible, todo_description, context_name| step "I should #{visible} \"#{todo_description}\" in the context container for \"#{context_name}\"" end