Merge pull request #1740 from dnrce/ruby-2.2

Support Ruby 2.2
This commit is contained in:
Dan Rice 2015-01-03 18:32:03 -05:00
commit f81efebd8c
6 changed files with 5 additions and 7 deletions

View file

@ -77,7 +77,6 @@ module RecurringTodos
end_date: attributes[:end_date],
ends_on: attributes[:ends_on],
number_of_occurences: attributes[:number_of_occurences],
target: attributes[:target],
project: attributes[:project],
context: attributes[:context],
project_id: attributes[:project_id],

View file

@ -62,7 +62,7 @@ class User < ActiveRecord::Base
end
def actionize(scope_conditions = {})
todos_in_project = where(scope_conditions).includes(:todos)
todos_in_project.to_a.sort!{ |x, y| -(x.todos.active.count <=> y.todos.active.count) }
todos_in_project.to_a.sort_by!{ |x| [-x.todos.active.count, -x.id] }
todos_in_project.reject{ |p| p.todos.active.count > 0 }
sorted_project_ids = todos_in_project.map {|p| p.id}