Fix calculation bug in cache_statistics function
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>spacecruft
parent
8dbea1c47e
commit
5eff9c7e13
|
@ -452,14 +452,15 @@ def cache_statistics():
|
|||
if sat['associated_satellite'] in sat_stats:
|
||||
sat_stats[sat['associated_satellite']]['count'] += sat['count']
|
||||
sat_stats[sat['associated_satellite']]['decoded'] += sat['decoded']
|
||||
if sat['latest_payload']:
|
||||
if sat_stats[sat['associated_satellite']
|
||||
]['latest_payload'] and sat['latest_payload']:
|
||||
sat_stats[sat['associated_satellite']]['latest_payload'] = max(
|
||||
[
|
||||
sat_stats[sat['associated_satellite']]['latest_payload'],
|
||||
sat['latest_payload']
|
||||
],
|
||||
default=sat['latest_payload']
|
||||
sat_stats[sat['associated_satellite']]['latest_payload'],
|
||||
sat['latest_payload']
|
||||
)
|
||||
else:
|
||||
sat_stats[sat['associated_satellite']
|
||||
]['latest_payload'] = sat['latest_payload']
|
||||
else:
|
||||
sat_id = sat['associated_satellite']
|
||||
del sat['associated_satellite']
|
||||
|
@ -477,11 +478,10 @@ def cache_statistics():
|
|||
]['satellite_identifier__sat_id'] = sat['satellite_identifier__sat_id']
|
||||
sat_stats[sat['id']]['count'] += sat['count']
|
||||
sat_stats[sat['id']]['decoded'] += sat['decoded']
|
||||
if sat_stats[sat['id']]['latest_payload']:
|
||||
if sat['latest_payload']:
|
||||
sat_stats[sat['id']]['latest_payload'] = max(
|
||||
sat_stats[sat['id']]['latest_payload'], sat['latest_payload']
|
||||
)
|
||||
if sat_stats[sat['id']]['latest_payload'] and sat['latest_payload']:
|
||||
sat_stats[sat['id']]['latest_payload'] = max(
|
||||
sat_stats[sat['id']]['latest_payload'], sat['latest_payload']
|
||||
)
|
||||
else:
|
||||
sat_stats[sat['id']]['latest_payload'] = sat['latest_payload']
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue