Skip to content
Snippets Groups Projects
Commit 81ee0797 authored by Cain, Payton David's avatar Cain, Payton David
Browse files

Order type imports, rename error message

parent 7c5440b6
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!91Residual Calculation for Web Service
......@@ -8,9 +8,9 @@ from ...algorithm import DbDtAlgorithm
from ...residual import (
calculate,
Reading,
MARK_TYPES,
INCLINATION_TYPES,
DECLINATION_TYPES,
INCLINATION_TYPES,
MARK_TYPES,
)
from .DataApiQuery import DataApiQuery
from .data import format_timeseries, get_data_factory, get_data_query, get_timeseries
......@@ -40,10 +40,10 @@ def get_dbdt(
def calculate_residual(reading: Reading, adjust_reference: bool = True):
missing_types = get_missing_measurement_types(reading=reading)
if len(missing_types) != 0:
error_message = ", ".join(t.value for t in missing_types)
missing_types = ", ".join(t.value for t in missing_types)
raise HTTPException(
status_code=400,
detail=f"Missing {error_message} measurements in input reading",
detail=f"Missing {missing_types} measurements in input reading",
)
return calculate(reading=reading, adjust_reference=adjust_reference)
......
......@@ -54,8 +54,8 @@ def average_measurement(
measurements = [m for m in measurements if m.measurement_type in types]
if len(measurements) == 0:
# no measurements to average
error_message = ", ".join(t.value for t in types)
raise ValueError(f"Missing {error_message} measurements")
missing_types = ", ".join(t.value for t in types)
raise ValueError(f"Missing {missing_types} measurements")
starttime = safe_min([m.time.timestamp for m in measurements if m.time])
endtime = safe_max([m.time.timestamp for m in measurements if m.time])
measurement = AverageMeasurement(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment