Fixed bug in manage-terms-top-set + added auto sorting in important-paste-by-module

This commit is contained in:
Mokaddem 2016-08-22 14:54:37 +02:00
parent e144e8e1c6
commit 2466f355ab
4 changed files with 11 additions and 7 deletions

View file

@ -113,7 +113,7 @@ if __name__ == "__main__":
temp = filename.split('/')
date = temp[-4] + temp[-3] + temp[-2]
timestamp = calendar.timegm((int(temp[-4]), int(temp[-3]), int(temp[-2]), 0, 0, 0))
top_termFreq_setName_day[0] += timestamp
top_termFreq_setName_day[0] += str(timestamp)
low_word = word.lower()

View file

@ -50,10 +50,12 @@ def manage_top_set():
dico = {}
# Retreive top data (2*max_card) from days sets
for timestamp in range(startDate, startDate - num_day_month*oneDay, -oneDay):
top_termFreq_setName_day[0] += str(timestamp)
array_top_day = server_term.zrangebyscore(top_termFreq_setName_day[0], '-inf', '+inf', withscores=True, start=0, num=top_term_freq_max_set_cardinality*2)
for timestamp in range(startDate, startDate - top_termFreq_setName_month[1]*oneDay, -oneDay):
curr_set = top_termFreq_setName_day[0] + str(timestamp)
print top_termFreq_setName_day[0]
array_top_day = server_term.zrangebyscore(curr_set, '-inf', '+inf', withscores=True, start=0, num=top_term_freq_max_set_cardinality*2)
print array_top_day
for word, value in array_top_day:
if word in dico.keys():
dico[word] += value
@ -68,12 +70,16 @@ def manage_top_set():
for w, v in dico.iteritems():
array_month.append((w, v))
array_month.sort(key=lambda tup: -tup[1])
array_month = array_month[0:20]
array_week = []
for w, v in dico_week.iteritems():
array_week.append((w, v))
array_week.sort(key=lambda tup: -tup[1])
array_week = array_week[0:20]
print array_month
print array_week
# suppress every terms in top sets
for curr_set, curr_num_day in top_termFreq_set_array[1:3]:

View file

@ -28,7 +28,7 @@
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
$('#myTable').dataTable();
$('#myTable').dataTable({ "order": [[ 2, "desc" ]] });
});
</script>

View file

@ -463,11 +463,9 @@ function hide_or_show() {
var curr_term = $(this).attr('data-term');
var graph = $(this).attr('data-graph');
var checked = $(this).prop('checked')
console.log(curr_term + ' ' + graph + ' ' + checked);
if(graph == "today") {
var graphData = plot_today.getData();
console.log(graphData);
var index;
for(i=0; i<graphData.length; i++){
if(graphData[i].label == curr_term){