Skip to content
Snippets Groups Projects
Commit d102b75d authored by Mario Raciti's avatar Mario Raciti
Browse files

TMSS-726: Fix _get_lta_dataproducts query; fix subtask creation in test

parent 5c741baf
No related branches found
No related tags found
1 merge request!413TMSS-726: Fix _get_lta_dataproducts query; fix subtask creation in test
...@@ -57,14 +57,14 @@ def _get_subs_and_durations_from_project(project_pk: int) -> {}: ...@@ -57,14 +57,14 @@ def _get_subs_and_durations_from_project(project_pk: int) -> {}:
return durations return durations
def _get_lta_dataproducts(project_name: str) -> int: def _get_lta_dataproducts(project_name: str) -> {}:
""" """
Help function to retrieve the sum of the LTA dataproducts sizes. Help function to retrieve the sum of the LTA dataproducts sizes.
""" """
# Query dataproducts from Subtasks of type 'ingest' within 'finished' status # Query dataproducts from Subtasks of type 'ingest' within 'finished' status
return models.Dataproduct.objects.filter(producer__subtask__specifications_template__type='ingest') \ return models.Dataproduct.objects.filter(producer__subtask__specifications_template__type='ingest') \
.filter(producer__subtask__state__value='finished') \ .filter(producer__subtask__state__value='finished') \
.filter(producer__subtask__task_blueprint__draft__scheduling_unit_draft__scheduling_set__project__name=project_name) \ .filter(producer__subtask__task_blueprints__draft__scheduling_unit_draft__scheduling_set__project__name=project_name) \
.aggregate(Sum('size')) .aggregate(Sum('size'))
......
...@@ -533,7 +533,8 @@ class ProjectReportTest(unittest.TestCase): ...@@ -533,7 +533,8 @@ class ProjectReportTest(unittest.TestCase):
tb = models.TaskBlueprint.objects.create(**TaskBlueprint_test_data(task_draft=self.task_draft, scheduling_unit_blueprint=sub)) tb = models.TaskBlueprint.objects.create(**TaskBlueprint_test_data(task_draft=self.task_draft, scheduling_unit_blueprint=sub))
# Create Subtask of type 'ingest' # Create Subtask of type 'ingest'
subtask_template = models.SubtaskTemplate.objects.create(**SubtaskTemplate_test_data(subtask_type_value='ingest')) subtask_template = models.SubtaskTemplate.objects.create(**SubtaskTemplate_test_data(subtask_type_value='ingest'))
subtask = models.Subtask.objects.create(**Subtask_test_data(task_blueprint=tb, subtask_template=subtask_template)) subtask = models.Subtask.objects.create(**Subtask_test_data(subtask_template=subtask_template))
subtask.task_blueprints.set([tb])
if status: # Set Subtask status to 'cancelled' if status: # Set Subtask status to 'cancelled'
with tmss_test_env.create_tmss_client() as client: with tmss_test_env.create_tmss_client() as client:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment