From 4eaecaad4942aca58da5a711f54ec6328f98d02e Mon Sep 17 00:00:00 2001 From: shri Date: Thu, 15 Aug 2024 13:56:14 +0200 Subject: [PATCH] Handle list of custom type tool when deserialising --- src/app/db/models/custom_types.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/db/models/custom_types.py b/src/app/db/models/custom_types.py index 30530231..855ff4ea 100644 --- a/src/app/db/models/custom_types.py +++ b/src/app/db/models/custom_types.py @@ -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