From e8fae17cfd7f96a002cf51a8492520734196a8a7 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Fri, 29 Jul 2016 10:36:44 +0200 Subject: [PATCH] Fixed small race condition bug in ModuleStat.py and Added highlight of bar belonging to the same serie in moduleStats.js --- bin/ModuleStats.py | 11 ++-- var/www/static/js/moduleTrending.js | 96 +++++++++++++++++------------ 2 files changed, 62 insertions(+), 45 deletions(-) diff --git a/bin/ModuleStats.py b/bin/ModuleStats.py index cfafedd0..8fed1949 100755 --- a/bin/ModuleStats.py +++ b/bin/ModuleStats.py @@ -61,11 +61,12 @@ def compute_most_posted(server, message, num_day): if keyw_value is not None: member_set.append((keyw, int(keyw_value))) member_set.sort(key=lambda tup: tup[1]) - if member_set[0][1] < keyword_total_sum: - #remove min from set and add the new one - print module + ': adding ' +keyword+ '(' +str(keyword_total_sum)+') in set and removing '+member_set[0][0]+'('+str(member_set[0][1])+')' - server.srem(redis_progression_name_set, member_set[0][0]) - server.sadd(redis_progression_name_set, keyword) + if len(member_set) > 0: + if member_set[0][1] < keyword_total_sum: + #remove min from set and add the new one + print module + ': adding ' +keyword+ '(' +str(keyword_total_sum)+') in set and removing '+member_set[0][0]+'('+str(member_set[0][1])+')' + server.srem(redis_progression_name_set, member_set[0][0]) + server.sadd(redis_progression_name_set, keyword) def compute_provider_info(server, path, num_day_to_look): diff --git a/var/www/static/js/moduleTrending.js b/var/www/static/js/moduleTrending.js index d5c8b378..afb764c4 100644 --- a/var/www/static/js/moduleTrending.js +++ b/var/www/static/js/moduleTrending.js @@ -67,7 +67,7 @@ function plot_top_graph(module_name, init){ } for(i=0; i" + y+"") .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) .fadeIn(200); - - var plot_other = plot_data_old[0]; - if (plot_other.length > 0){ - var data_other = plot_other[0].data; + var plot_obj = plot_data_old[0]; //contain series + for(serie=0; serie" + curr_data_other+"") - .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) - .fadeIn(200); - for(i=0; i" + curr_data_other+"") - .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) - .fadeIn(200); - for(i=0; i" + curr_data_other+"") + .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) + .fadeIn(200); + for(i=0; i" + curr_data_other+"") + .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) + .fadeIn(200); + for(i=0; i