From 2e903f6b1fbb9ad180198e742345b24b8fd0a196 Mon Sep 17 00:00:00 2001 From: jacob-a-brown Date: Thu, 11 Dec 2025 11:34:36 -0700 Subject: [PATCH 1/2] fix: add missing well inventory fields and fix contact association Fix the special request notes for a contact Fix adding a ContantThingAssociation in contact_helper.py Keep well_purposes in the thing data --- api/well_inventory.py | 3 +-- services/contact_helper.py | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/api/well_inventory.py b/api/well_inventory.py index 4f7769609..8aeb14896 100644 --- a/api/well_inventory.py +++ b/api/well_inventory.py @@ -87,7 +87,7 @@ def _make_contact(model: WellInventoryRow, well: Thing, idx) -> dict: notes = [] for content, note_type in ( (model.result_communication_preference, "Communication"), - (model.contact_special_instructions, "General"), + (model.contact_special_requests_notes, "General"), ): if content is not None: notes.append({"content": content, "note_type": note_type}) @@ -546,7 +546,6 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user) ) well_data = data.model_dump( exclude=[ - "well_purposes", "well_casing_materials", ] ) diff --git a/services/contact_helper.py b/services/contact_helper.py index 5c5245683..5e9766be9 100644 --- a/services/contact_helper.py +++ b/services/contact_helper.py @@ -98,13 +98,12 @@ def add_contact(session: Session, data: CreateContact | dict, user: dict) -> Con session.flush() session.refresh(contact) if thing_id is not None: - location_contact_association = ThingContactAssociation() - location_contact_association.thing_id = thing_id - location_contact_association.contact_id = contact.id + thing_contact_association = ThingContactAssociation() + thing_contact_association.thing_id = thing_id + thing_contact_association.contact_id = contact.id - audit_add(user, location_contact_association) - - session.add(location_contact_association) + audit_add(user, thing_contact_association) + session.add(thing_contact_association) session.flush() session.commit() From 4ca56832cc8ec49039659af0f34837d5613714b6 Mon Sep 17 00:00:00 2001 From: jacob-a-brown Date: Thu, 11 Dec 2025 11:44:55 -0700 Subject: [PATCH 2/2] fix: note_type is 'Historical' not 'Historic' --- api/well_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/well_inventory.py b/api/well_inventory.py index 6a7ec6aac..90c6e0300 100644 --- a/api/well_inventory.py +++ b/api/well_inventory.py @@ -509,7 +509,7 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user) (model.special_requests, "General"), (model.well_measuring_notes, "Sampling Procedure"), (model.sampling_scenario_notes, "Sampling Procedure"), - (historic_depth_note, "Historic"), + (historic_depth_note, "Historical"), ): if note_content is not None: well_notes.append({"content": note_content, "note_type": note_type})