This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Public: Returns an optimized hash object for mobile representation of weekly activities. | |
# | |
# The returned hash would look like this {"Monday" => [schedule_items], "Tuesday" => [], ...} | |
def current_week_for_mobile | |
start = proxy_association.owner.local_time.beginning_of_week | |
end = proxy_association.owner.local_time.end_of_week | |
(start..end).inject({}) do |memo,day| | |
memo[Date::DAYNAMES[day.wday]] = ScheduleItem.where(date: day.to_date) | |
memo |