Skip to content
Snippets Groups Projects
Commit caa72f81 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

OSB-36: Make the errors unique

parent be2b46f5
No related branches found
No related tags found
2 merge requests!89Monitoring maintenance Epic branch merge,!1Resolve OSB-13 "Monitoringmaintenance "
...@@ -953,10 +953,10 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView): ...@@ -953,10 +953,10 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView):
end_datetime__lt=self.to_date, end_datetime__lt=self.to_date,
station__name=self.station_name).\ station__name=self.station_name).\
exclude(errors_summary__rcu__in=list(rcus_per_polarization.keys())).\ exclude(errors_summary__rcu__in=list(rcus_per_polarization.keys())).\
order_by('-start_datetime').values('pk', values('pk',
'observation_id', 'observation_id',
'start_datetime', 'start_datetime',
'end_datetime') 'end_datetime').distinct('pk')
result = [] result = []
for observation in good_observation_list: for observation in good_observation_list:
entry = dict(test_id=observation['observation_id'], entry = dict(test_id=observation['observation_id'],
...@@ -1020,29 +1020,27 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView): ...@@ -1020,29 +1020,27 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView):
component_errors=dict()) component_errors=dict())
rcu = item['rcu'] rcu = item['rcu']
polarization = rcus_per_polarization[rcu] polarization = rcus_per_polarization[rcu]
if polarization not in errors[observation_pk]:
errors[observation_pk]['component_errors'][polarization] = dict(
rcu=rcu,
errors = dict()
)
error_type = item['error_type'] error_type = item['error_type']
percentage = item['percentage'] percentage = item['percentage']
count = item['count'] count = item['count']
mode = item['mode'] mode = item['mode']
samples = item['observation__samples'] samples = item['observation__samples']
if error_type not in errors[observation_pk]['component_errors']:
errors[observation_pk]['component_errors'][error_type] = dict()
url_to_plot = reverse('rtsm-summary-plot-detail', (item['pk'],), request=self.request) url_to_plot = reverse('rtsm-summary-plot-detail', (item['pk'],), request=self.request)
errors[observation_pk]['component_errors'][polarization]['errors'][error_type] = dict(samples=samples, errors[observation_pk]['component_errors'][error_type][polarization] = dict(samples=samples,
percentage=percentage, percentage=percentage,
count=count, count=count,
mode=mode, mode=mode,
rcu=rcu,
url=url_to_plot) url=url_to_plot)
return list(errors.values()) return list(errors.values())
def compute_station_tests_error_list(self): def compute_station_tests_error_list(self):
errors = dict() errors = dict()
rcus_per_polarization = self.rcus_from_antenna_and_type(self.antenna_id,
self.component_type)
component_errors = ComponentError.objects.filter( component_errors = ComponentError.objects.filter(
station_test__start_datetime__gt=self.from_date, station_test__start_datetime__gt=self.from_date,
station_test__end_datetime__lt=self.to_date, station_test__end_datetime__lt=self.to_date,
...@@ -1058,20 +1056,15 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView): ...@@ -1058,20 +1056,15 @@ class ControllerStationComponentElementErrors(ValidableReadOnlyView):
end_date=component_error.station_test.end_datetime, end_date=component_error.station_test.end_datetime,
test_type='S', test_type='S',
component_errors=dict()) component_errors=dict())
for rcu_id, polarization in rcus_per_polarization.items(): error_type = component_error.type
if polarization not in errors[station_test_pk]: details = component_error.details
errors[station_test_pk]['component_errors'][polarization] = dict( errors[station_test_pk]['component_errors'][error_type] = dict(details=details, element_errors = dict())
rcu=rcu_id,
errors=dict())
error_type = component_error.type
details = component_error.details
errors_per_error_polarization = errors[station_test_pk]['component_errors'][polarization]['errors']
errors_per_error_polarization[error_type] = dict(details=details, element_errors=dict())
error_per_error_type = errors[station_test_pk]['component_errors'][error_type]
for element in component_error.failing_elements.values('element__element_id', 'details'): for element in component_error.failing_elements.values('element__element_id', 'details'):
element_id = element['element__element_id'] element_id = element['element__element_id']
errors_per_error_polarization[error_type]['element_errors'][element_id] = element['details'] error_per_error_type["element_errors"][element_id] = element['details']
return list(errors.values()) return list(errors.values())
......
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