Skip to content
Closed
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/geospatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def get_project_area(
user: viewer_dependency, session: session_dependency, group_id: int
) -> FeatureCollectionResponse:

group = simple_get_by_id(session, Group, group_id)
group: Group = simple_get_by_id(session, Group, group_id)

if not group.project_area:
raise HTTPException(status_code=404, detail="Group has no project area")
Expand Down Expand Up @@ -99,8 +99,6 @@ def get_feature_collection(
Endpoint to retrieve a GeoJSON FeatureCollection.
"""

things = get_thing_features(session, thing_type, group)

def make_feature_dict(thing, geometry, elevation, *other):
geometry = json.loads(geometry)
geometry["coordinates"].append(elevation)
Expand All @@ -115,6 +113,7 @@ def make_feature_dict(thing, geometry, elevation, *other):
"geometry": geometry,
}

things = get_thing_features(session, thing_type, group)
features = [make_feature_dict(*item) for item in things]

return {
Expand Down
18 changes: 9 additions & 9 deletions db/thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Thing(
cascade="all, delete-orphan",
passive_deletes=True,
order_by="LocationThingAssociation.effective_start.desc()",
lazy="joined",
# lazy="joined",
)

contact_associations = relationship(
Expand Down Expand Up @@ -254,23 +254,23 @@ class Thing(
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

well_casing_materials: Mapped[List["WellCasingMaterial"]] = relationship(
"WellCasingMaterial",
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

links: Mapped[List["ThingIdLink"]] = relationship(
"ThingIdLink",
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

# One-To-Many: A Thing (well) can have multiple measuring points over time.
Expand All @@ -279,15 +279,15 @@ class Thing(
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

monitoring_frequencies: Mapped[List["MonitoringFrequencyHistory"]] = relationship(
"MonitoringFrequencyHistory",
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

# One-To-Many: A Thing can be associated with many AquiferSystems via the ThingAquiferAssociation join table.
Expand All @@ -296,7 +296,7 @@ class Thing(
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)

# Many-To-Many: A Thing can penetrate many GeologicFormations.
Expand All @@ -306,7 +306,7 @@ class Thing(
back_populates="thing",
cascade="all, delete-orphan",
passive_deletes=True,
lazy="joined",
# lazy="joined",
)
)

Expand Down Expand Up @@ -349,7 +349,7 @@ class Thing(
search_vector = Column(TSVectorType("name"))

# for temporary backwards compatibility
well_construction_notes = mapped_column(String(1000), nullable=True)
# well_construction_notes = mapped_column(String(1000), nullable=True)
Comment on lines 351 to +352

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore mapping for well_construction_notes

Commenting out well_construction_notes removes the ORM attribute from Thing, so any code that tries to read or serialize this field now fails. Thing responses still include the field (e.g., schemas/thing.py:409) and tests assert it is present (e.g., tests/test_thing.py:454-456), so hitting water-well endpoints will raise an AttributeError or drop the column from API output. This regression affects every request that fetches or updates wells with construction notes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well_construction_notes was removed from the thing model during the implementation of well-notes.feature. Rather than comment it out I think that it can be removed altogether.


@property
def current_location(self):
Expand Down
2 changes: 1 addition & 1 deletion services/query_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def simple_get_by_name(session, table, name) -> object | None:

def simple_get_by_id(
session: Session, table: DeclarativeBase, item_id: int
) -> object | None:
) -> DeclarativeBase | None:
"""
Helper function to get a record by ID from the database.
"""
Expand Down
Loading