Skip to content

Commit

Permalink
Extract methods for when packet was built
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 5, 2024
1 parent 22d9930 commit 4f6431d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/models/daily_packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,34 @@ def reading_list_phrase
end

def chore_list
built_on_weekend = built_on.saturday? || built_on.sunday?
built_on_summertime = (4..10).cover?(built_on.month)

chores = []
chores << "unload dishwasher"
chores << "collect laundry" if built_on_weekend
chores << "collect laundry" if built_on_weekend?
chores << "defrost meat"

if built_on_weekend && built_on_summertime
if built_on_weekend? && built_during_summer?
chores << "poop patrol"
chores << "mow front"
chores << "mow back"
chores << "mow way back"
end

chores << "put out garbage cans" if built_on.monday?
chores << "put out garbage cans" if built_on_monday?
chores << "wipe off kitchen table"
chores << "run dishwasher"

chores
end

def built_on_monday?
built_on.monday?
end

def built_on_weekend?
built_on.saturday? || built_on.sunday?
end

def built_during_summer?
(4..10).cover?(built_on.month)
end
end

0 comments on commit 4f6431d

Please sign in to comment.