From 5732d7b13470f263c26a0b10d511676dded2ebd9 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Wed, 19 Sep 2018 15:36:33 +0200 Subject: [PATCH] fix: [hashDecoded] range_type_json --- bin/Decoder.py | 4 ++-- var/www/modules/hashDecoded/Flask_hashDecoded.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/Decoder.py b/bin/Decoder.py index af385fed..abbf760b 100755 --- a/bin/Decoder.py +++ b/bin/Decoder.py @@ -103,8 +103,8 @@ def save_hash(decoder_name, message, date, decoded): serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type) # first time we see this hash today - if serv_metadata.zscore('hash_date:'+date_key, hash) is None: - serv_metadata.zincrby('hash_type:'+type, date_key, 1) + #if serv_metadata.zscore('hash_date:'+date_key, hash) is None: + # serv_metadata.zincrby('hash_type:'+type, date_key, 1) # first time we see this hash encoding today if serv_metadata.zscore(decoder_name+'_date:'+date_key, hash) is None: diff --git a/var/www/modules/hashDecoded/Flask_hashDecoded.py b/var/www/modules/hashDecoded/Flask_hashDecoded.py index a40a5a00..7d8981c9 100644 --- a/var/www/modules/hashDecoded/Flask_hashDecoded.py +++ b/var/www/modules/hashDecoded/Flask_hashDecoded.py @@ -444,13 +444,13 @@ def range_type_json(): range_type = [] + list_decoder = r_serv_metadata.smembers('all_decoder') for date in date_range: if len(date_range) == 1: if date==date_from and date==date_to: for type in all_type: day_type = {} day_type['date']= type - list_decoder = r_serv_metadata.smembers('all_decoder') for decoder in list_decoder: num_day_decoder = r_serv_metadata.zscore(decoder+'_type:'+type, date) if num_day_decoder is None: @@ -463,9 +463,11 @@ def range_type_json(): day_type = {} day_type['date']= date[0:4] + '-' + date[4:6] + '-' + date[6:8] for type in all_type: - num_day_type = r_serv_metadata.zscore('hash_type:'+type, date) - if num_day_type is None: - num_day_type = 0 + num_day_type = 0 + for decoder in list_decoder: + num_day_type_decoder = r_serv_metadata.zscore(decoder+'_type:'+type, date) + if num_day_type_decoder is not None: + num_day_type += num_day_type_decoder day_type[type]= num_day_type range_type.append(day_type)