Skip to content

Commit

Permalink
chore: don't save errors in LabelAnalysisRequest object (#99)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
giovanni-guidini committed Sep 15, 2023
1 parent 6d00e5f commit 21338dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tasks/label_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 21338dc

Please sign in to comment.