mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [hashDecoded] range_type_json
This commit is contained in:
parent
73622acab3
commit
5732d7b134
2 changed files with 8 additions and 6 deletions
|
@ -103,8 +103,8 @@ def save_hash(decoder_name, message, date, decoded):
|
||||||
serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type)
|
serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type)
|
||||||
|
|
||||||
# first time we see this hash today
|
# first time we see this hash today
|
||||||
if serv_metadata.zscore('hash_date:'+date_key, hash) is None:
|
#if serv_metadata.zscore('hash_date:'+date_key, hash) is None:
|
||||||
serv_metadata.zincrby('hash_type:'+type, date_key, 1)
|
# serv_metadata.zincrby('hash_type:'+type, date_key, 1)
|
||||||
|
|
||||||
# first time we see this hash encoding today
|
# first time we see this hash encoding today
|
||||||
if serv_metadata.zscore(decoder_name+'_date:'+date_key, hash) is None:
|
if serv_metadata.zscore(decoder_name+'_date:'+date_key, hash) is None:
|
||||||
|
|
|
@ -444,13 +444,13 @@ def range_type_json():
|
||||||
|
|
||||||
range_type = []
|
range_type = []
|
||||||
|
|
||||||
|
list_decoder = r_serv_metadata.smembers('all_decoder')
|
||||||
for date in date_range:
|
for date in date_range:
|
||||||
if len(date_range) == 1:
|
if len(date_range) == 1:
|
||||||
if date==date_from and date==date_to:
|
if date==date_from and date==date_to:
|
||||||
for type in all_type:
|
for type in all_type:
|
||||||
day_type = {}
|
day_type = {}
|
||||||
day_type['date']= type
|
day_type['date']= type
|
||||||
list_decoder = r_serv_metadata.smembers('all_decoder')
|
|
||||||
for decoder in list_decoder:
|
for decoder in list_decoder:
|
||||||
num_day_decoder = r_serv_metadata.zscore(decoder+'_type:'+type, date)
|
num_day_decoder = r_serv_metadata.zscore(decoder+'_type:'+type, date)
|
||||||
if num_day_decoder is None:
|
if num_day_decoder is None:
|
||||||
|
@ -463,9 +463,11 @@ def range_type_json():
|
||||||
day_type = {}
|
day_type = {}
|
||||||
day_type['date']= date[0:4] + '-' + date[4:6] + '-' + date[6:8]
|
day_type['date']= date[0:4] + '-' + date[4:6] + '-' + date[6:8]
|
||||||
for type in all_type:
|
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
|
day_type[type]= num_day_type
|
||||||
range_type.append(day_type)
|
range_type.append(day_type)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue