From e9d173c7b28e45db4f27ad50cdf286489b86d8f3 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Fri, 16 Sep 2022 10:07:23 -0400 Subject: [PATCH] Add empty projects to export dataframe so they will appear in both formats (#587) --- miqa/core/tasks.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/miqa/core/tasks.py b/miqa/core/tasks.py index 79af7891..c902c2cb 100644 --- a/miqa/core/tasks.py +++ b/miqa/core/tasks.py @@ -313,7 +313,7 @@ def export_data(project_id: Optional[str]): @shared_task def perform_export(project_id: Optional[str]): - data = [] + data: List[List[Optional[str]]] = [] export_warnings = [] if project_id is None: @@ -328,14 +328,17 @@ def perform_export(project_id: Optional[str]): export_path = project.export_path for project_object in projects: - for frame_object in Frame.objects.filter(scan__experiment__project=project_object): + project_frames = Frame.objects.filter(scan__experiment__project=project_object) + if project_frames.count() == 0: + data.append([project_object.name]) + for frame_object in project_frames: if frame_object.storage_mode == StorageMode.LOCAL_PATH: row_data = [ project_object.name, frame_object.scan.experiment.name, frame_object.scan.name, frame_object.scan.scan_type, - frame_object.frame_number, + str(frame_object.frame_number), frame_object.raw_path, frame_object.scan.experiment.note, frame_object.scan.subject_id, @@ -365,7 +368,7 @@ def perform_export(project_id: Optional[str]): last_decision.decision, creator, last_decision.note.replace(',', ';'), - last_decision.created, + str(last_decision.created), ';'.join(artifacts), location, ]