More code style fixes

This commit is contained in:
Jyri-Petteri Paloposki 2020-10-27 21:39:19 +02:00
parent 465419f46a
commit d4c9041ccd
61 changed files with 406 additions and 422 deletions

View file

@ -4,23 +4,23 @@ class DoneTodos
return done_today(completed_todos), done_rest_of_week(completed_todos), done_rest_of_month(completed_todos)
end
def self.done_today(todos, includes={ :include => Todo::DEFAULT_INCLUDES })
def self.done_today(todos, includes = { :include => Todo::DEFAULT_INCLUDES })
# TODO: refactor to remove outer hash from includes param
todos.completed_after(beginning_of_day).includes(includes[:include])
end
def self.done_rest_of_week(todos, includes={ :include => Todo::DEFAULT_INCLUDES })
def self.done_rest_of_week(todos, includes = { :include => Todo::DEFAULT_INCLUDES })
done_between(todos, includes, beginning_of_day, beginning_of_week)
end
def self.done_rest_of_month(todos, includes={ :include => Todo::DEFAULT_INCLUDES })
def self.done_rest_of_month(todos, includes = { :include => Todo::DEFAULT_INCLUDES })
done_between(todos, includes, beginning_of_week, beginning_of_month)
end
def self.completed_period(date)
return nil if date.nil?
return "today" if date >= end_of_day # treat todos with completed_at in future as done today (happens in tests)
return "today" if date >= end_of_day # Treat todos with completed_at in future as done today (happens in tests)
return "today" if date.between?(beginning_of_day, end_of_day)
return "rest_of_week" if date >= beginning_of_week
return "rest_of_month" if date >= beginning_of_month
@ -28,7 +28,7 @@ class DoneTodos
end
def self.remaining_in_container(todos, period)
count = self.send("done_#{period}", todos.completed, {}).count
count = send("done_#{period}", todos.completed, {}).count
return nil if period.nil?
return count
end