SETTINGS-35: species $/bdft in Settings + taxonomy parent fix (#76)
Add Settings species pricing UI (children of Species grouper by slug, never hardcoded ids). Map Woo REST parent→parent_id on taxonomy sync; upsert categories so slab FKs survive re-sync. Tests: parent map, FK-safe sync, TV-8 0.96×12.50→12.00, Playwright mock e2e. UAT verified on 5060.
This commit is contained in:
@@ -87,6 +87,47 @@ def test_price_suggestion_from_rate(env):
|
||||
assert body["price"] == 184.0
|
||||
|
||||
|
||||
def test_price_suggestion_tv8_quality_90(env):
|
||||
"""QUALITY-90 / TV-8: 0.96 bdft × $12.50 → 12.00."""
|
||||
client, conn = env
|
||||
conn.execute(
|
||||
"INSERT INTO pricing_rules(species_id,price_per_bdft,created_at,updated_at) VALUES (1,12.50,'t','t')"
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO slabs(id,sku,length_in,thickness_in,sqft,bdft,width_min_in,width_max_in,width_avg_in,species_id,wood_category_ids,figure_term_ids,price,price_source,title,short_description,description,content_source,status,server_rev,client_rev,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
(
|
||||
"s1",
|
||||
"SLAB-01",
|
||||
114.0,
|
||||
1.75,
|
||||
30.0,
|
||||
0.96,
|
||||
18.0,
|
||||
24.3,
|
||||
24.3,
|
||||
1,
|
||||
json.dumps([2]),
|
||||
json.dumps([1]),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
"A slab",
|
||||
"manual",
|
||||
"calibrated",
|
||||
1,
|
||||
1,
|
||||
"t",
|
||||
"t",
|
||||
),
|
||||
)
|
||||
conn.commit()
|
||||
r = client.post("/api/v1/slabs/s1/review", json={})
|
||||
body = r.json()
|
||||
assert body["price_suggestion"] == 12.00
|
||||
assert body["price"] == 12.00
|
||||
|
||||
|
||||
def test_knife_blank_carries_dims(env):
|
||||
client, conn = env
|
||||
conn.execute("INSERT INTO woo_categories(id,name,slug,parent_id,woo_id) VALUES (3,'Knife blanks','knife-blanks',NULL,102)")
|
||||
|
||||
Reference in New Issue
Block a user