Skip to content

Commit

Permalink
Make sure features are converted to whombat schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
mbsantiago committed Dec 4, 2024
1 parent 351ff06 commit e9b4e54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion back/src/whombat/api/sound_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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=[
Expand Down

0 comments on commit e9b4e54

Please sign in to comment.