fixed bug that didn't allow choice to be None

This commit is contained in:
Brian Bjarke Jensen
2025-09-20 10:26:57 +02:00
parent 26edf8d372
commit 604b00c8ed
@@ -58,19 +58,19 @@ class AnnotationRepository(MinioAdapter, AnnotationRepositoryInterface):
data_str = buffer.read().decode(self.encoding)
data = json.loads(data_str)
annotation = Annotation(
angle=AngleEnum(data["angle"]),
angle=AngleEnum(data["angle"]) if data["angle"] is not None else None,
angle_uncertainty=bool(data["angle_uncertainty"]),
colour=ColourEnum(data["colour"]),
colour=ColourEnum(data["colour"]) if data["colour"] is not None else None,
colour_uncertainty=bool(data["colour_uncertainty"]),
contact=ContactEnum(data["contact"]),
contact=ContactEnum(data["contact"]) if data["contact"] is not None else None,
contact_uncertainty=bool(data["contact_uncertainty"]),
depth=DepthEnum(data["depth"]),
depth=DepthEnum(data["depth"]) if data["depth"] is not None else None,
depth_uncertainty=bool(data["depth_uncertainty"]),
distance=DistanceEnum(data["distance"]),
distance=DistanceEnum(data["distance"]) if data["distance"] is not None else None,
distance_uncertainty=bool(data["distance_uncertainty"]),
lighting=LightingEnum(data["lighting"]),
lighting=LightingEnum(data["lighting"]) if data["lighting"] is not None else None,
lighting_uncertainty=bool(data["lighting_uncertainty"]),
point_of_view=PointOfViewEnum(data["point_of_view"]),
point_of_view=PointOfViewEnum(data["point_of_view"]) if data["point_of_view"] is not None else None,
point_of_view_uncertainty=bool(data["point_of_view_uncertainty"]),
)
except (KeyError, ValueError) as e: