mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
fix: [UI-Hash] pie decoder
This commit is contained in:
parent
9c03c40482
commit
3479923f96
2 changed files with 20 additions and 6 deletions
|
@ -350,10 +350,23 @@ def decoder_type_json():
|
||||||
date_from = request.args.get('date_from')
|
date_from = request.args.get('date_from')
|
||||||
date_to = request.args.get('date_to')
|
date_to = request.args.get('date_to')
|
||||||
|
|
||||||
type = request.args.get('type')
|
typ = request.args.get('type')
|
||||||
encoding = request.args.get('encoding')
|
|
||||||
|
if typ == 'All types':
|
||||||
|
typ = None
|
||||||
|
|
||||||
|
# verify file type input
|
||||||
|
if typ is not None:
|
||||||
|
#retrieve + char
|
||||||
|
typ = typ.replace(' ', '+')
|
||||||
|
if typ not in r_serv_metadata.smembers('hash_all_type'):
|
||||||
|
typ = None
|
||||||
|
|
||||||
all_decoder = r_serv_metadata.smembers('all_decoder')
|
all_decoder = r_serv_metadata.smembers('all_decoder')
|
||||||
|
# sort DESC decoder for color
|
||||||
|
all_decoder = sorted(all_decoder, reverse=True)
|
||||||
|
print(all_decoder)
|
||||||
|
print(type(all_decoder))
|
||||||
|
|
||||||
date_range = []
|
date_range = []
|
||||||
if date_from is not None and date_to is not None:
|
if date_from is not None and date_to is not None:
|
||||||
|
@ -372,10 +385,10 @@ def decoder_type_json():
|
||||||
nb_decoded = {}
|
nb_decoded = {}
|
||||||
for date in date_range:
|
for date in date_range:
|
||||||
for decoder in all_decoder:
|
for decoder in all_decoder:
|
||||||
if type is None:
|
if typ is None:
|
||||||
nb_decoded[decoder] = r_serv_metadata.get(decoder+'_decoded:'+date)
|
nb_decoded[decoder] = r_serv_metadata.get(decoder+'_decoded:'+date)
|
||||||
else:
|
else:
|
||||||
nb_decoded[decoder] = r_serv_metadata.hget(decoder+'_type:'+type, date)
|
nb_decoded[decoder] = r_serv_metadata.zscore(decoder+'_type:'+typ, date)
|
||||||
if nb_decoded[decoder] is None:
|
if nb_decoded[decoder] is None:
|
||||||
nb_decoded[decoder] = 0
|
nb_decoded[decoder] = 0
|
||||||
|
|
||||||
|
|
|
@ -525,11 +525,12 @@ var arc_pie = d3.arc()
|
||||||
.innerRadius(0)
|
.innerRadius(0)
|
||||||
.outerRadius(radius_pie);
|
.outerRadius(radius_pie);
|
||||||
|
|
||||||
d3.json("/hashDecoded/decoder_type_json?date_from={{date_from}}&date_to={{date_to}}")
|
d3.json("/hashDecoded/decoder_type_json?date_from={{date_from}}&date_to={{date_to}}&type={{type}}")
|
||||||
.then(function(data){
|
.then(function(data){
|
||||||
|
|
||||||
var pie_pie = d3.pie()
|
var pie_pie = d3.pie()
|
||||||
.value(function(d) { return d.value; });
|
.value(function(d) { return d.value; })
|
||||||
|
.sort(null);
|
||||||
|
|
||||||
var path_pie = g_pie.selectAll('path')
|
var path_pie = g_pie.selectAll('path')
|
||||||
.data(pie_pie(data))
|
.data(pie_pie(data))
|
||||||
|
|
Loading…
Reference in a new issue