fix: Only add ranking if the rank isn't 0

pull/12/head
Raphaël Vinot 2018-04-10 11:57:47 +02:00
parent 583bdfccd3
commit 4be3636a39
1 changed files with 8 additions and 6 deletions

View File

@ -69,11 +69,13 @@ class Ranking():
v4count = self.asn_meta.get(f'{v4_last}|{asn}|v4|ipcount')
v6count = self.asn_meta.get(f'{v6_last}|{asn}|v6|ipcount')
if v4count:
asn_rank_v4 /= int(v4count)
asn_rank_v4 /= float(v4count)
if asn_rank_v4:
r_pipeline.set(f'{today}|{source}|{asn}|rankv4', asn_rank_v4)
r_pipeline.zincrby(asns_aggregation_key_v4, asn, asn_rank_v4)
if v6count:
asn_rank_v6 /= int(v6count)
asn_rank_v6 /= float(v6count)
if asn_rank_v6:
r_pipeline.set(f'{today}|{source}|{asn}|rankv6', asn_rank_v6)
r_pipeline.zincrby(asns_aggregation_key_v6, asn, asn_rank_v6)
r_pipeline.execute()