From 0106b6c12e23a7cf3d2d5a64cba60824217758f9 Mon Sep 17 00:00:00 2001 From: reecehill <29638128+reecehill@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:10:22 +0000 Subject: [PATCH] only create xlsx file if the csv file was created --- project/npda/general_functions/csv/csv_upload.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/project/npda/general_functions/csv/csv_upload.py b/project/npda/general_functions/csv/csv_upload.py index c01cc191..56644db1 100644 --- a/project/npda/general_functions/csv/csv_upload.py +++ b/project/npda/general_functions/csv/csv_upload.py @@ -293,6 +293,8 @@ async def validate_rows_in_parallel(rows_by_patient, async_client): except Exception as error: errors_to_return[visit_row_index]["__all__"].append(error) - # Copy csv to a styled xlsx. - _ = write_errors_to_xlsx(errors_to_return, new_submission) + # Only create xlsx file if the csv file was created. + if new_submission.csv_file: + _ = write_errors_to_xlsx(errors_to_return, new_submission) + return errors_to_return