Fixed bug in flask with zrange (was taking the bottom of the set instead of the top leading to get only the min instead of max)

pull/68/head
Mokaddem 2016-08-22 16:12:20 +02:00
parent 003c72bd7c
commit a424069c64
1 changed files with 2 additions and 2 deletions

View File

@ -350,7 +350,7 @@ def providersChart():
redis_provider_name_set = 'top_avg_size_set_' if module_name == "size" else 'providers_set_' redis_provider_name_set = 'top_avg_size_set_' if module_name == "size" else 'providers_set_'
redis_provider_name_set = redis_provider_name_set + get_date_range(0)[0] redis_provider_name_set = redis_provider_name_set + get_date_range(0)[0]
member_set = r_serv_charts.zrangebyscore(redis_provider_name_set, '-inf', '+inf', withscores=True, start=0, num=8) member_set = r_serv_charts.zrevrangebyscore(redis_provider_name_set, '+inf', '-inf', withscores=True, start=0, num=8)
# Member set is a list of (value, score) pairs # Member set is a list of (value, score) pairs
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)))
@ -509,7 +509,7 @@ def sentiment_analysis_getplotdata():
dateStart_timestamp = calendar.timegm(dateStart.timetuple()) dateStart_timestamp = calendar.timegm(dateStart.timetuple())
to_return = {} to_return = {}
range_providers = r_serv_charts.zrangebyscore('providers_set_'+ get_date_range(0)[0], '-inf', '+inf', start=0, num=8) range_providers = r_serv_charts.zrevrangebyscore('providers_set_'+ get_date_range(0)[0], '+inf', '-inf', start=0, num=8)
if range_providers == []: if range_providers == []:
print 'today provider empty' print 'today provider empty'
range_providers = r_serv_charts.smembers('all_provider_set') range_providers = r_serv_charts.smembers('all_provider_set')