fix(review): carry Measure species into Create title/short-desc
Live overnight slabs after removing the Review species picker had species_id null, so Create title stayed gated off. Require species on Measure Calculate, stop the select sync from wiping choices before options load, and have Review gate/PUT from slab.species_id with a Capture handoff repair so deterministic title/short-desc always see it.
This commit is contained in:
@@ -200,6 +200,30 @@ def test_get_not_found(client, db):
|
||||
assert resp.status_code == 404
|
||||
|
||||
|
||||
|
||||
def test_update_omitting_species_id_preserves_it(client, db):
|
||||
"""Review PUTs omit species_id after Measure owns it — must not null the column."""
|
||||
slab_id = str(uuid.uuid4())
|
||||
create = {
|
||||
"id": slab_id, "sku": "", "length_in": 48, "thickness_in": 2, "sqft": 6.25, "bdft": 12.5,
|
||||
"width_min_in": 10, "width_max_in": 12, "width_avg_in": 11, "species_id": 1,
|
||||
}
|
||||
r = client.post("/api/v1/slabs", json=create)
|
||||
assert r.status_code == 201, r.text
|
||||
assert r.json()["species_id"] == 1
|
||||
rev = r.json()["server_rev"]
|
||||
# PUT like Review commitReview: wood cats only, no species_id key.
|
||||
r2 = client.put(f"/api/v1/slabs/{slab_id}", json={
|
||||
"client_rev": rev,
|
||||
"wood_category_ids": [2],
|
||||
"title": None,
|
||||
"short_description": None,
|
||||
})
|
||||
assert r2.status_code == 200, r2.text
|
||||
assert r2.json()["species_id"] == 1
|
||||
assert r2.json()["wood_category_ids"] == [2]
|
||||
|
||||
|
||||
def test_update_success(client, db):
|
||||
slab_id = str(uuid.uuid4())
|
||||
payload = {"id": slab_id, "sku": "SKU001", "length_in":10,"thickness_in":2,"sqft":20,"bdft":5,"width_min_in":1,"width_max_in":2,"width_avg_in":1.5,"species_id":1,"wood_category_ids":json.dumps([2]),"edge_type_term_id":1,"figure_term_ids":json.dumps([1]),"grade_term_id":1,"thickness_term_id":1,"moisture_term_id":1,"fig_tag_ids":json.dumps([1]),"feat_tag_ids":json.dumps([2]),"price":100,"price_source":"recommendation","title":"Test","short_description":"short","description":"desc","content_source":"manual","species_confidence":0.9,"figure_confidence":0.8,"grade_confidence":0.7,"inference_status":"inferring","calibration_photo_id":None}
|
||||
|
||||
Reference in New Issue
Block a user