mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 08:10:13 +01:00
fix failing tests
not sure if the to_a fixes to get collections from activerecord is the right way
This commit is contained in:
parent
35cab99cea
commit
2430fcb906
5 changed files with 11 additions and 7 deletions
|
|
@ -34,8 +34,8 @@ class StatsController < ApplicationController
|
||||||
@interpolated_actions_created_this_month = interpolate_avg_for_current_month(@actions_created_last12months_array)
|
@interpolated_actions_created_this_month = interpolate_avg_for_current_month(@actions_created_last12months_array)
|
||||||
@interpolated_actions_done_this_month = interpolate_avg_for_current_month(@actions_done_last12months_array)
|
@interpolated_actions_done_this_month = interpolate_avg_for_current_month(@actions_done_last12months_array)
|
||||||
|
|
||||||
@created_count_array = Array.new(13, actions_last12months.created_after(@cut_off_year).count/12.0)
|
@created_count_array = Array.new(13, actions_last12months.created_after(@cut_off_year).count(:all)/12.0)
|
||||||
@done_count_array = Array.new(13, actions_last12months.completed_after(@cut_off_year).count/12.0)
|
@done_count_array = Array.new(13, actions_last12months.completed_after(@cut_off_year).count(:all)/12.0)
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ class StatsController < ApplicationController
|
||||||
@max_actions = @actions_completion_time_array.max
|
@max_actions = @actions_completion_time_array.max
|
||||||
|
|
||||||
# get percentage done cumulative
|
# get percentage done cumulative
|
||||||
@cum_percent_done = convert_to_cumulative_array(@actions_completion_time_array, @actions_completion_time.count)
|
@cum_percent_done = convert_to_cumulative_array(@actions_completion_time_array, @actions_completion_time.count(:all))
|
||||||
|
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,13 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
def alphabetize(scope_conditions = {})
|
def alphabetize(scope_conditions = {})
|
||||||
projects = where(scope_conditions)
|
projects = where(scope_conditions)
|
||||||
projects.sort!{ |x,y| x.name.downcase <=> y.name.downcase }
|
projects.to_a.sort!{ |x,y| x.name.downcase <=> y.name.downcase }
|
||||||
self.update_positions(projects.map{ |p| p.id })
|
self.update_positions(projects.map{ |p| p.id })
|
||||||
return projects
|
return projects
|
||||||
end
|
end
|
||||||
def actionize(scope_conditions = {})
|
def actionize(scope_conditions = {})
|
||||||
todos_in_project = where(scope_conditions).includes(:todos)
|
todos_in_project = where(scope_conditions).includes(:todos)
|
||||||
todos_in_project.sort!{ |x, y| -(x.todos.active.count <=> y.todos.active.count) }
|
todos_in_project.to_a.sort!{ |x, y| -(x.todos.active.count <=> y.todos.active.count) }
|
||||||
todos_in_project.reject{ |p| p.todos.active.count > 0 }
|
todos_in_project.reject{ |p| p.todos.active.count > 0 }
|
||||||
sorted_project_ids = todos_in_project.map {|p| p.id}
|
sorted_project_ids = todos_in_project.map {|p| p.id}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ function show_in_tickler_box() {
|
||||||
|
|
||||||
function regenerate_predecessor_family() {
|
function regenerate_predecessor_family() {
|
||||||
<%
|
<%
|
||||||
parents = @predecessors
|
parents = @predecessors.to_a
|
||||||
until parents.empty?
|
until parents.empty?
|
||||||
parent = parents.pop
|
parent = parents.pop
|
||||||
parents += parent.predecessors -%>
|
parents += parent.predecessors -%>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ function replace_updated_predecessor() {
|
||||||
|
|
||||||
function regenerate_predecessor_family() {
|
function regenerate_predecessor_family() {
|
||||||
<%
|
<%
|
||||||
parents = @predecessors
|
parents = @predecessors.to_a
|
||||||
until parents.empty?
|
until parents.empty?
|
||||||
parent = parents.pop
|
parent = parents.pop
|
||||||
parents += parent.predecessors -%>
|
parents += parent.predecessors -%>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
@completed = Todo.find(8).reload
|
@completed = Todo.find(8).reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def next_week
|
||||||
|
1.week.from_now.beginning_of_day.to_s(:db)
|
||||||
|
end
|
||||||
|
|
||||||
# Test loading a todo item
|
# Test loading a todo item
|
||||||
def test_load
|
def test_load
|
||||||
assert_kind_of Todo, @not_completed1
|
assert_kind_of Todo, @not_completed1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue