feat: the 8 mm between a ready sheet's copies stay on the film but are no longer billed (Marcus, 2026-12-03)
All checks were successful
Build and deploy / Validate source (push) Successful in 59s
Build and deploy / Integration suite on a real stack (push) Successful in 8m58s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m45s

Marcus on 26/11 had the gaps count in the billed metres; on 2026-12-03,
after customers of Lais and Kedma refused orders billed 10 and 20 cm more,
"por hora pode tirar a cobrança". A ready sheet is now billed on the sum of
its sheets and copies (pricing.billable_metres: the layout's height less
unbilled_gaps_cm, at most 8 mm between each two pieces); `metres` stays the
film laid out, which the print file, the parts and the folders follow, and
the print file's billed-length guard allows the gap film. Loose art keeps
its packing. The Site bills folhaCobradaM, the copies line reads
"5 × 45,9 cm = 229,3 cm" and the buy box explains that length. The Lais
case, 5 sheets of 100 cm, bills 5,00 m instead of 5,10 m.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-03 11:24:13 -03:00
parent 3b4f851fc2
commit 911892351f
10 changed files with 91 additions and 21 deletions

View File

@@ -170,6 +170,24 @@ class CartPricingCharacterizationTest(unittest.TestCase):
floating = priced('band-floating-metres')[0]
self.assertEqual((floating['billed_metres'], floating['total_cents']), ('2.8', 23800))
def test_a_ready_sheet_is_billed_without_its_gaps(self):
# Marcus, 2026-12-03 ("por hora pode tirar a cobrança"): the Lais case,
# one 100 cm sheet and another with 4 copies, 4 gaps of 8 mm = 503,2 cm.
sheet = item('file', '5.032')
sheet['production']['placements'] = [
{'source_index': 0, 'copy_index': i, 'x_cm': 0, 'y_cm': i * 100.8, 'width_cm': 57,
'length_cm': 100, 'rotation_degrees': 0, 'mirrored': False} for i in range(5)]
priced = price_items([sheet], {}, catalog_now(), 0)[0]
self.assertEqual(priced['billed_metres'], '5')
self.assertEqual(priced['total_cents'], 9950)
self.assertEqual(priced['metres'], '5.032') # the film stays as laid out
self.assertEqual(pricing.unbilled_gaps_cm(sheet['production']), Decimal('3.2'))
# Loose art keeps its packing; one piece has no gap.
loose = item('avulsa', '1.5')
loose['production']['placements'] = sheet['production']['placements']
self.assertEqual(pricing.unbilled_gaps_cm(loose['production']), 0)
self.assertEqual(pricing.unbilled_gaps_cm(item('file', '1')['production']), 0)
def test_ajuste_fino_is_per_art_with_the_band(self):
# Front 1a: 1 to 9 arts at R$ 9,90, from 10 at R$ 6,90, all arts charged
# at the band. `true` keeps meaning every art of the cart.