feat: Ajuste Fino priced per art, with the offer under each Prumo warning (Marcus 10/11, point 1)
The designer treatment becomes Ajuste Fino, priced per art with a batch band set in the Site tab (e.g. R$ 9,90, from 10 arts R$ 6,90). Under each art the Prumo warns about, the Site offers 'Quer que um designer resolva? Ajuste Fino'; the cart keeps 'Ajuste Fino em todas as artes'. The server counts the chosen arts, Tiny gets the line with that quantity, the card shows 'Ajuste Fino · N artes'. Old carts asking the treatment for the whole order keep working. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import unittest
|
||||
from decimal import Decimal
|
||||
|
||||
from app import catalog
|
||||
from app.cart_pricing import price_items
|
||||
from app.cart_pricing import price_items, treatment_price
|
||||
from app.core import pricing
|
||||
|
||||
|
||||
@@ -156,6 +156,21 @@ class CartPricingCharacterizationTest(unittest.TestCase):
|
||||
floating = priced('band-floating-metres')[0]
|
||||
self.assertEqual((floating['billed_metres'], floating['total_cents']), ('2.9', 24650))
|
||||
|
||||
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.
|
||||
offer = {'enabled': True, 'unit_cents': 990,
|
||||
'bands': [{'from_metres': '10', 'unit_cents': 690}]}
|
||||
for arts, unit in ((1, 990), (9, 990), (10, 690), (12, 690)):
|
||||
items = [item('avulsa', '1', uid=f'u{index}') for index in range(arts)]
|
||||
self.assertEqual(treatment_price(items, True, offer),
|
||||
{'cents': unit * arts, 'hours': 24, 'arts': arts, 'unit_cents': unit})
|
||||
items = [item('file', '1', uid='u1'), item('file', '1', uid='u2')]
|
||||
self.assertEqual(treatment_price(items, [[1, 0]], offer),
|
||||
{'cents': 990, 'hours': 24, 'arts': 1, 'unit_cents': 990})
|
||||
self.assertEqual(treatment_price(items, [], offer), {})
|
||||
self.assertEqual(treatment_price(items, True, {**offer, 'enabled': False}), {})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user