Skip to content

Commit

Permalink
Leverage the project projection which handles units.
Browse files Browse the repository at this point in the history
  • Loading branch information
matteius committed Oct 3, 2024
1 parent c8a3d45 commit 0fd4e2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opensensor/collection_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def create_model_instance(model: Type[BaseModel], data: dict, target_unit: Optio

# Handle temperature unit conversion if applicable
if field_name == "temp" and target_unit and mongo_field in data:
data[field_name] = convert_temperature(data[mongo_field], data.get("unit"), target_unit)
data[field_name] = convert_temperature(data[mongo_field], target_unit)
elif mongo_field in data:
data[field_name] = data[mongo_field]
elif field_name in data:
Expand Down

0 comments on commit 0fd4e2f

Please sign in to comment.