From 7a4b226c905e3a94bcf784233a25c375a636a313 Mon Sep 17 00:00:00 2001 From: Jon Allured Date: Mon, 4 Nov 2024 21:31:24 -0600 Subject: [PATCH] On weekend skip the work section on top three page --- app/models/daily_packet/pdf_view.rb | 18 ++++++++++-------- spec/models/daily_packet/pdf_view_spec.rb | 12 ++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/models/daily_packet/pdf_view.rb b/app/models/daily_packet/pdf_view.rb index 58916c1..ac849bd 100644 --- a/app/models/daily_packet/pdf_view.rb +++ b/app/models/daily_packet/pdf_view.rb @@ -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 diff --git a/spec/models/daily_packet/pdf_view_spec.rb b/spec/models/daily_packet/pdf_view_spec.rb index a01281f..962c7d1 100644 --- a/spec/models/daily_packet/pdf_view_spec.rb +++ b/spec/models/daily_packet/pdf_view_spec.rb @@ -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") }