From 21338dc8633363aee8a569998b218ae138958768 Mon Sep 17 00:00:00 2001 From: Giovanni M Guidini <99758426+giovanni-guidini@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:31:25 -0300 Subject: [PATCH] chore: don't save errors in `LabelAnalysisRequest` object (#99) In the case where we have some missing information we were saving the errors as part of the result dict (in the database). There's a dedicated table for the larq errors, they should not be saved in the database. THese changes fix that adding the errors to the dict to return only after savign the real results. --- tasks/label_analysis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/label_analysis.py b/tasks/label_analysis.py index 88e9b6809..6b6512146 100644 --- a/tasks/label_analysis.py +++ b/tasks/label_analysis.py @@ -137,16 +137,16 @@ async def run_async(self, db_session, request_id, *args, **kwargs): ), ) label_analysis_request.state_id = LabelAnalysisRequestState.FINISHED.db_id - result = { + result_to_save = { "success": True, "present_report_labels": [], "present_diff_labels": [], "absent_labels": label_analysis_request.requested_labels, "global_level_labels": [], - "errors": self.errors, } - label_analysis_request.result = result - return result + label_analysis_request.result = result_to_save + result_to_return = {**result_to_save, "errors": self.errors} + return result_to_return def add_processing_error( self,