Skip to content

Commit a4e29ae

Browse files
committed
attempt to resolve conflicts with migration path
1 parent 6fd74cb commit a4e29ae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

opensensor/collection_apis.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@
5454
"Moisture": "moisture_readings",
5555
}
5656

57+
column_translation = {
58+
"temp": "temp",
59+
"rh": "rh",
60+
"pressure": "pressure",
61+
"percent": "lux",
62+
"ppm": "ppm_CO2",
63+
"pH": "pH",
64+
"readings": "moisture_readings",
65+
}
66+
5767

5868
class Params(BaseParams):
5969
size: int = Query(50, ge=1, le=1000, description="Page size")
@@ -111,7 +121,7 @@ def _record_data_to_ts_collection(
111121
model_instance.pop("timestamp", None)
112122

113123
# Translate to the combined collection field names
114-
column_name = new_collections[model_instance.__class__.__name__]
124+
column_name = column_translation[column_name]
115125

116126
for key, value in model_instance.items():
117127
if value is not None:

0 commit comments

Comments
 (0)