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

TMSS-610: Add data_ingested_per_site_and_type info

parent 356840f1
No related branches found
No related tags found
3 merge requests!634WIP: COBALT commissioning delta,!492Resolve TMSS-610,!481Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
......@@ -18,7 +18,7 @@ def create_cycle_report(request: Request, cycle: models.Cycle) -> {}:
'completion_level': _get_completion_level(cycle),
'observation_hours_per_category': _get_observation_hours_per_category(cycle),
'weekly_efficiency': _get_weekly_efficiency(cycle),
'data_ingested_per_site_and_category': _get_data_ingested_per_site_and_category(cycle),
'data_ingested_per_site_and_type': _get_data_ingested_per_site_and_type(request, cycle),
'projects_summary': _get_projects_summary(request, cycle),
'usage_mode': _get_usage_mode(cycle),
'failures': _get_failures(cycle),
......@@ -150,11 +150,24 @@ def _get_weekly_efficiency(cycle: models.Cycle):
return 0
def _get_data_ingested_per_site_and_category(cycle: models.Cycle):
def _get_data_ingested_per_site_and_type(request: Request, cycle: models.Cycle) -> []:
"""
Help function to retrieve data ingested per site and category info.
Help function to retrieve data ingested per site and type info.
"""
return 0
result = []
# Get DataProducts related to the cycle
dataproducts = models.Dataproduct.objects.filter(producer__subtask__task_blueprints__draft__scheduling_unit_draft__scheduling_set__project__cycles=cycle.pk)
# TODO: Group dataproducts also per site.
# Iterate over types
datatypes = [c for c in models.Datatype.Choices]
for dt in datatypes:
dataproducts_per_type = dataproducts.filter(datatype=dt.value)
dataproducts_per_type_data = [serializers.DataproductSerializer(dp, context={'request': request}).data for dp in dataproducts_per_type]
result.append({'type': dt.value, 'dataproducts': dataproducts_per_type_data})
return result
def _get_projects_summary(request: Request, cycle: models.Cycle) -> {}:
......@@ -218,7 +231,11 @@ def _get_usage_mode(cycle: models.Cycle) -> []:
def _get_failures(cycle: models.Cycle):
return 0
"""
Help function to retrieve failures rate info as a function of time.
"""
# TODO: See TMSS-662 for details.
return None
# Project Report
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment