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:
@@ -133,6 +133,22 @@ class PricingTests(unittest.TestCase):
|
||||
with self.subTest(metres=metres):
|
||||
self.assertEqual(cents, band_price(PRICES['file'], bands, Decimal(metres)))
|
||||
|
||||
def test_ajuste_fino_band_against_actual_site_javascript(self):
|
||||
# Ajuste Fino counts its band in arts: the Site helper must charge the
|
||||
# same unit price as catalog.band_price.
|
||||
source = Path('web/site-config.js').read_text()
|
||||
body = source.split('function precoAjuste', 1)[1].split('\n}', 1)[0]
|
||||
bands = [{'from_metres': 10, 'unit_cents': 690}]
|
||||
js = ('const TAXA_TRATAMENTO=9.9;const FAIXAS=' + json.dumps({'tratamento': bands}) + ';'
|
||||
'function precoAjuste' + body + '\n}'
|
||||
';const results=[];for(const n of [1,9,10,12])'
|
||||
'results.push([n,Math.round(precoAjuste(n)*100)]);'
|
||||
'process.stdout.write(JSON.stringify(results));')
|
||||
cases = json.loads(subprocess.check_output(['node', '-e', js], text=True))
|
||||
for arts, cents in cases:
|
||||
with self.subTest(arts=arts):
|
||||
self.assertEqual(cents, band_price(990, bands, Decimal(arts)))
|
||||
|
||||
def test_which_items_are_opened_by_hand(self):
|
||||
def item(kind, measurement, uid='u1'):
|
||||
return {'production': {'sources': [{'kind': kind, 'measurement': measurement, 'upload_id': uid}]}}
|
||||
|
||||
Reference in New Issue
Block a user