Skip to content

Commit

Permalink
[Back-End]: GMN-MeasuringPoints 500 Error
Browse files Browse the repository at this point in the history
Fixes #114
  • Loading branch information
StevenHosper committed Oct 31, 2024
1 parent 39ec53c commit cb18493
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gmn/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ def get_location(self, obj: gmn_models.Measuringpoint) -> str | None:
.standardized_location
)

def get_gmw_uuid(self, obj: gmw_models.MonitoringTube) -> str | None:
def get_gmw_uuid(self, obj: gmn_models.Measuringpoint) -> str | None:
try:
return gmw_models.GMW.objects.get(
bro_id=obj.gmw.bro_id, data_owner=obj.data_owner
bro_id=obj.gmw_bro_id, data_owner=obj.data_owner
).uuid
except ObjectDoesNotExist:
return None
except MultipleObjectsReturned:
return (
gmw_models.GMW.objects.filter(
bro_id=obj.gmw.bro_id, data_owner=obj.data_owner
bro_id=obj.gmw_bro_id, data_owner=obj.data_owner
)
.first()
.uuid
)

def get_monitoringtube_uuid(self, obj: gmw_models.MonitoringTube) -> str | None:
def get_monitoringtube_uuid(self, obj: gmn_models.Measuringpoint) -> str | None:
try:
gmw_uuid = self.get_gmw_uuid(obj)
return gmw_models.MonitoringTube.objects.get(
Expand All @@ -69,7 +69,7 @@ def get_monitoringtube_uuid(self, obj: gmw_models.MonitoringTube) -> str | None:
except MultipleObjectsReturned:
return (
gmw_models.MonitoringTube.objects.filter(
bro_id=obj.gmw.bro_id,
gmw=gmw_uuid,
tube_number=obj.tube_number,
data_owner=obj.data_owner,
)
Expand Down

0 comments on commit cb18493

Please sign in to comment.