Skip to content

Commit

Permalink
Merge pull request #3440 from cielf/3285-package-count-correction
Browse files Browse the repository at this point in the history
3285 Distribution pdf package count correction
  • Loading branch information
Daniel Orner authored Mar 8, 2023
2 parents 4d6f7e8 + 469b212 commit ee9e37a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/pdfs/distribution_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def request_data
"",
dollar_value(c.item.value_in_cents),
dollar_value(c.value_per_line_item),
c.package_count]
nil]
end

data + [["", "", "", "", ""],
Expand Down
4 changes: 3 additions & 1 deletion spec/pdfs/distribution_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
let(:item1) { FactoryBot.create(:item, name: "Item 1", package_size: 50, value_in_cents: 100) }
let(:item2) { FactoryBot.create(:item, name: "Item 2", value_in_cents: 200) }
let(:item3) { FactoryBot.create(:item, name: "Item 3", value_in_cents: 300) }
let(:item4) { FactoryBot.create(:item, name: "Item 4", package_size: 25, value_in_cents: 400) }
before(:each) do
FactoryBot.create(:line_item, itemizable: distribution, item: item1, quantity: 50)
FactoryBot.create(:line_item, itemizable: distribution, item: item2, quantity: 100)
FactoryBot.create(:request, distribution: distribution,
request_items: [{"item_id" => item2.id, "quantity" => 30},
{"item_id" => item3.id, "quantity" => 50}])
{"item_id" => item3.id, "quantity" => 50}, {"item_id" => item4.id, "quantity" => 120}])
end

specify "#request_data" do
Expand All @@ -20,6 +21,7 @@
["Item 1", "", 50, "$1.00", "$50.00", "1"],
["Item 2", 30, 100, "$2.00", "$200.00", nil],
["Item 3", 50, "", "$3.00", "$150.00", nil],
["Item 4", 120, "", "$4.00", "$480.00", nil],
["", "", "", "", ""],
["Total Items Received", 80, 150, "", "$250.00", ""]
])
Expand Down

0 comments on commit ee9e37a

Please sign in to comment.