Fixed bug in flask not correctly displaying the number of paste/providers

This commit is contained in:
Mokaddem 2016-08-08 11:39:17 +02:00
parent 14062a549c
commit 084737dd26

View file

@ -305,12 +305,19 @@ def providersChart():
keyw_value_size = r_serv_charts.hget(redis_provider_name_size, get_date_range(0)[0]) keyw_value_size = r_serv_charts.hget(redis_provider_name_size, get_date_range(0)[0])
keyw_value_size = keyw_value_size if keyw_value_size is not None else 0.0 keyw_value_size = keyw_value_size if keyw_value_size is not None else 0.0
keyw_value_num = r_serv_charts.hget(redis_provider_name_num, get_date_range(0)[0]) keyw_value_num = r_serv_charts.hget(redis_provider_name_num, get_date_range(0)[0])
keyw_value_num = keyw_value_num if keyw_value_num is not None else 0
keyw_value_num = keyw_value_num if int(keyw_value_num) != 0 else 10000000000 if keyw_value_num is not None:
keyw_value_num = int(keyw_value_num)
else:
if module_name == "size":
keyw_value_num = 10000000000
else:
keyw_value_num = 0
if module_name == "size": if module_name == "size":
member_set.append((keyw, float(keyw_value_size)/float(keyw_value_num))) member_set.append((keyw, float(keyw_value_size)/float(keyw_value_num)))
else: else:
member_set.append((keyw, float(keyw_value_num))) member_set.append((keyw, float(keyw_value_num)))
member_set.sort(key=lambda tup: tup[1], reverse=True) member_set.sort(key=lambda tup: tup[1], reverse=True)
if len(member_set) == 0: if len(member_set) == 0:
member_set.append(("No relevant data", float(100))) member_set.append(("No relevant data", float(100)))