diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py index 58f7584329ef491c260ebb62dd50c002a8b3ae1d..1f86d2fa7b54ef82e74aa87be730943aca692085 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py @@ -36,6 +36,9 @@ def _get_subs_and_durations_from_project(project_pk: int) -> {}: def create_project_report(request: Request, project: models.Project) -> {}: + """ + Create a project report as a JSON object. + """ # TODO: Retrieve the information needed, all in one go. project_pk = project.pk result = {'project': project_pk} # Object to be returned @@ -48,4 +51,12 @@ def create_project_report(request: Request, project: models.Project) -> {}: # Add durations to result result['durations'] = _get_subs_and_durations_from_project(project_pk) + # Subtask of type 'ingest' within 'finished' status + subtasks = models.Subtask.objects.filter(specifications_template__type='ingest', state='finished') + for subtask in subtasks: + # TODO: Get sum of dataproduct sizes that went to the ingest + output_dataproducts = models.SubtaskOutput.filter(subtask=subtask.pk) + + # TODO: For each unique target (SAP name) get the sum of target observation durations from the tasks. + return result