From 4f6431d82809971b7969206d4cf3ff53c761075a Mon Sep 17 00:00:00 2001 From: Jon Allured Date: Mon, 4 Nov 2024 21:31:10 -0600 Subject: [PATCH] Extract methods for when packet was built --- app/models/daily_packet.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/models/daily_packet.rb b/app/models/daily_packet.rb index 00e3fcb..1c7d611 100644 --- a/app/models/daily_packet.rb +++ b/app/models/daily_packet.rb @@ -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