Skip to content

Commit

Permalink
On weekend skip the work section on top three page
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 5, 2024
1 parent 4f6431d commit 7a4b226
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/models/daily_packet/pdf_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ def draw_top_three_page

move_down 30

text "Work", size: 30
unless daily_packet.built_on_weekend?
text "Work", size: 30

move_down 10

font_size(20) do
text "1. #{"_" * 40}"
move_down 10
text "2. #{"_" * 40}"
move_down 10
text "3. #{"_" * 40}"

font_size(20) do
text "1. #{"_" * 40}"
move_down 10
text "2. #{"_" * 40}"
move_down 10
text "3. #{"_" * 40}"
end
end
end

Expand Down
12 changes: 12 additions & 0 deletions spec/models/daily_packet/pdf_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
end
end

context "on a Saturday" do
let(:built_on) { Date.parse("2024-11-09") }

it "does not render the work top three section" do
inspector = PDF::Inspector::Page.analyze(daily_packet.pdf_data)

_, page_two_strings, _ = inspector.pages.map { |page| page[:strings] }

expect(page_two_strings).to_not include "Work"
end
end

context "on a Saturday in the fall" do
let(:built_on) { Date.parse("2024-11-09") }

Expand Down

0 comments on commit 7a4b226

Please sign in to comment.