Skip to content

Commit

Permalink
Move chore list item logic into model
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 5, 2024
1 parent 4593198 commit 22d9930
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
23 changes: 23 additions & 0 deletions app/models/daily_packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,27 @@ def headline_phrase
def reading_list_phrase
"#{reading_list_pace} pages/day"
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 << "defrost meat"

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

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

chores
end
end
16 changes: 2 additions & 14 deletions app/models/daily_packet/pdf_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,10 @@ def draw_chore_list_page

move_down 30

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

font_size(20) do
text "unload dishwasher"
text "collect laundry" if daily_packet.built_on.saturday? || daily_packet.built_on.sunday?
text "defrost meat"
if built_on_weekend && built_on_summertime
text "poop patrol"
text "mow front"
text "mow back"
text "mow way back"
daily_packet.chore_list.each do |chore|
text chore
end
text "put out garbage cans" if daily_packet.built_on.monday?
text "wipe off kitchen table"
text "run dishwasher"
end
end
end

0 comments on commit 22d9930

Please sign in to comment.