Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api/well_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -563,7 +563,6 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user)
)
well_data = data.model_dump(
exclude=[
"well_purposes",
"well_casing_materials",
]
)
Expand Down
11 changes: 5 additions & 6 deletions services/contact_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading