Skip to content

Commit

Permalink
Handle list of custom type tool when deserialising
Browse files Browse the repository at this point in the history
  • Loading branch information
shri committed Aug 15, 2024
1 parent 05d20da commit 4eaecaa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/db/models/custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ def process_result_value(self, value, dialect):
obj = Tool.from_dict(value)
obj.certainty = Scale(obj.certainty) if obj.certainty else Scale.LOW
return obj
elif value and isinstance(value, list):
objs = []
for item in value:
obj = Tool.from_dict(item)
obj.certainty = Scale(obj.certainty) if obj.certainty else Scale.LOW
objs.append(obj)
return objs
return None

0 comments on commit 4eaecaa

Please sign in to comment.