Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 0 additions & 1 deletion snowexsql/tables/layer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class LayerData(HasMeasurementType, HasInstrument, Base):

depth = Column(Float, nullable=False, index=True)
bottom_depth = Column(Float)
comments = Column(Text)
value = Column(Text, nullable=False, index=True)

# Link the site id with a foreign key
Expand Down
5 changes: 4 additions & 1 deletion snowexsql/tables/site.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List

from sqlalchemy import (
Column, Date, Float, ForeignKey, Integer, String, Index
Column, Date, Float, ForeignKey, Index, Integer, String, Text
)
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import Mapped, mapped_column, relationship
Expand Down Expand Up @@ -37,6 +37,9 @@ class Site(SingleLocationData, Base, InCampaign, HasDOI):
name = Column(String(), nullable=False) # This can be pit_id
description = Column(String())

# Example: Top right comment section on a pit sheet
comments = Column(Text)

# Link the observer
# id is a mapped column for many-to-many with observers
id: Mapped[int] = mapped_column(primary_key=True)
Expand Down
2 changes: 0 additions & 2 deletions tests/factories/layer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Meta:

depth = 100.0
bottom_depth = 90.0
comments = 'Layer comment'
value = '40'

measurement_type = factory.SubFactory(
Expand All @@ -41,7 +40,6 @@ class LayerDensityFactory(LayerDataFactory):
depth = 15.0
bottom_depth = 5.0
value = '236.0'
comments = 'Sample_A'

site = factory.SubFactory(
SiteFactory,
Expand Down
2 changes: 2 additions & 0 deletions tests/factories/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Meta:
description = 'Site Description'
datetime = factory.LazyFunction(lambda: datetime.now(timezone.utc))

comments = "Observer comment on site"

slope_angle = 0.0
aspect = 0.0
air_temp = -5.0
Expand Down
3 changes: 0 additions & 3 deletions tests/tables/test_layer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def test_bottom_depth_attribute(self):
assert type(self.subject.bottom_depth) is float
assert self.subject.bottom_depth == self.attributes.bottom_depth

def test_comments_attribute(self):
assert self.subject.comments == self.attributes.comments

def test_value_attribute(self):
assert self.subject.value == self.attributes.value

Expand Down
5 changes: 5 additions & 0 deletions tests/tables/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def test_elevation_attribute(self, point_data_factory):
def test_geom_attribute(self):
assert isinstance(self.subject.geom, WKBElement)

def test_comments_attribute(self):
assert self.subject.comments == self.attributes.comments

# Relationships
# -------------
def test_in_campaign(self):
assert self.subject.campaign is not None
assert isinstance(self.subject.campaign, Campaign)
Expand Down