From b52a1bb6c076a520cebb90c7e46dffcf3fc0da51 Mon Sep 17 00:00:00 2001 From: cwhel2026 Date: Tue, 1 Dec 2026 19:58:15 +0000 Subject: [PATCH 1/2] Remove approved restoration minimum while retaining travel and volume discounts --- apps/api/app/services/pricing_engine.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/api/app/services/pricing_engine.py b/apps/api/app/services/pricing_engine.py index 5574e57d..e559df3d 100644 --- a/apps/api/app/services/pricing_engine.py +++ b/apps/api/app/services/pricing_engine.py @@ -204,12 +204,12 @@ async def calculate_quotation( coating_charge = money(total_area * coat_rate) minimum_job = _rule_amount(rules, PricingRuleType.MINIMUM_JOB) - if minimum_job is None: + if minimum_job is None and not approved: raise ValueError("No minimum job charge configured on the active pricing profile") territory_minimum = ( data.territory.minimum_job_value_gbp if data.territory else Decimal("0") ) - effective_minimum = minimum_job if approved else max(minimum_job, territory_minimum) + effective_minimum = Decimal("0") if approved else max(minimum_job, territory_minimum) # Minimum applies to the works (surface + washing + coating) before travel. # Travel is added afterwards. This order is intentional and matches the previous engine. @@ -405,8 +405,8 @@ async def calculate_quotation( "policy_source": "owner_configured" if configured_discount_policy else "approved_defaults", }, "minimum_rule": ( - "Works subtotal is raised to the greater of the pricing-rule minimum " - "and the territory minimum. Travel is added after that. " + ("Approved restoration has no minimum job charge. " if approved else "Works subtotal is raised to the greater of the pricing-rule minimum and the territory minimum. ") + + "Travel is added after that. " "The amount the customer pays is then rounded up to the next £5. " "VAT is added before that rounding only when the company is VAT registered " "on the pricing date." From bf79e28ed8c14fde5317982af73fe928a5f533c6 Mon Sep 17 00:00:00 2001 From: cwhel2026 Date: Tue, 1 Dec 2026 19:58:19 +0000 Subject: [PATCH 2/2] Remove approved restoration minimum while retaining travel and volume discounts --- apps/api/tests/test_approved_restoration_pricing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/tests/test_approved_restoration_pricing.py b/apps/api/tests/test_approved_restoration_pricing.py index 80ed6f99..4c1a28b9 100644 --- a/apps/api/tests/test_approved_restoration_pricing.py +++ b/apps/api/tests/test_approved_restoration_pricing.py @@ -16,7 +16,7 @@ ("imprinted-concrete-restoration", SurfaceType.IMPRINTED_CONCRETE, "approved-clear", "12", "3", "810"), ("imprinted-concrete-colour-restoration", SurfaceType.IMPRINTED_CONCRETE, "approved-colour", "14", "2.97", "930"), ]) -@pytest.mark.parametrize("area", [10, 20, 50, 60, 84, 100, 200]) +@pytest.mark.parametrize("area", [10, 18, 20, 50, 60, 84, 100, 200]) async def test_approved_restoration(monkeypatch, slug, surface, label, rate, materials, expected, area): profile = PricingProfile(id=uuid4(), name="surfacecoat-approved-restoration", version=3) profile.rules = [ @@ -41,7 +41,7 @@ async def active(db): assert result.breakdown["visits"] == 2 assert result.vat_gbp == 0 assert result.estimated_materials_gbp == Decimal(materials) * area - works = max(Decimal('350'), Decimal(rate) * area) + works = Decimal(rate) * area expected_total = ((works + Decimal('86')) / 5).to_integral_value(rounding=ROUND_CEILING) * 5 assert expected_total % 5 == 0 discounts = {50: Decimal(".03"), 60: Decimal(".03"), 84: Decimal(".03"), 100: Decimal(".05"), 200: Decimal(".10")}