From e9b4e54c7e3c45aeaeae960fdffa415a375965b3 Mon Sep 17 00:00:00 2001 From: mbsantiago Date: Wed, 4 Dec 2024 15:23:48 +0000 Subject: [PATCH] Make sure features are converted to whombat schemas --- back/src/whombat/api/sound_events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/back/src/whombat/api/sound_events.py b/back/src/whombat/api/sound_events.py index 0ddb4b42..5fda03b4 100644 --- a/back/src/whombat/api/sound_events.py +++ b/back/src/whombat/api/sound_events.py @@ -327,6 +327,7 @@ async def update_geometric_features( The updated sound event. """ geom_features = compute_geometric_features(sound_event.geometry) + for feature in geom_features: try: sound_event = await self.update_feature( @@ -341,7 +342,9 @@ async def update_geometric_features( schemas.Feature(name=feature.name, value=feature.value), ) - feature_mapping = {f.name: f for f in geom_features} + feature_mapping = { + f.name: schemas.Feature.model_validate(f) for f in geom_features + } sound_event = sound_event.model_copy( update=dict( features=[