mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
fixed a bug in manage_term (usage of loop.index0) + fixed bug in top_set where graph was not displaying the correct per_paste value
This commit is contained in:
parent
a1c47d7a13
commit
4071bf2e91
5 changed files with 35 additions and 28 deletions
|
@ -120,14 +120,14 @@ if __name__ == "__main__":
|
|||
#consider the num of occurence of this term
|
||||
curr_word_value = int(server_term.hincrby(timestamp, low_word, int(score)))
|
||||
#1 term per paste
|
||||
curr_word_value_perPaste = int(server_term.hincrby(timestamp, low_word, int(1)))
|
||||
curr_word_value_perPaste = int(server_term.hincrby("per_paste_" + str(timestamp), low_word, int(1)))
|
||||
|
||||
# Add in set only if term is not in the blacklist
|
||||
if low_word not in server_term.smembers(BlackListTermsSet_Name):
|
||||
#consider the num of occurence of this term
|
||||
server_term.zincrby(curr_set, low_word, float(score))
|
||||
#1 term per paste
|
||||
server_term.zincrby("per_paste_" + curr_set, low_word, float(score))
|
||||
server_term.zincrby("per_paste_" + curr_set, low_word, float(1))
|
||||
|
||||
#Add more info for tracked terms
|
||||
check_if_tracked_term(low_word, filename)
|
||||
|
|
|
@ -63,7 +63,7 @@ def manage_top_set():
|
|||
else:
|
||||
dico[word] = value
|
||||
|
||||
for word, value in "per_paste_" + array_top_day:
|
||||
for word, value in array_top_day_per_paste:
|
||||
if word not in server_term.smembers(BlackListTermsSet_Name):
|
||||
if word in dico_per_paste.keys():
|
||||
dico_per_paste[word] += value
|
||||
|
|
|
@ -208,16 +208,21 @@ def terms_plot_top_data():
|
|||
today = today.replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
today_timestamp = calendar.timegm(today.timetuple())
|
||||
|
||||
set_day = "TopTermFreq_set_day_" + str(today_timestamp)
|
||||
set_week = "TopTermFreq_set_week";
|
||||
set_month = "TopTermFreq_set_month";
|
||||
|
||||
the_set = request.args.get('set')
|
||||
num_day = int(request.args.get('num_day'))
|
||||
per_paste = int(request.args.get('per_paste'))
|
||||
if per_paste == 1:
|
||||
the_set = "per_paste_" + the_set
|
||||
per_paste = "per_paste_"
|
||||
else:
|
||||
per_paste = ""
|
||||
|
||||
set_day = per_paste + "TopTermFreq_set_day_" + str(today_timestamp)
|
||||
set_week = per_paste + "TopTermFreq_set_week";
|
||||
set_month = per_paste + "TopTermFreq_set_month";
|
||||
|
||||
the_set = per_paste + request.args.get('set')
|
||||
num_day = int(request.args.get('num_day'))
|
||||
|
||||
print(set_day)
|
||||
print(per_paste)
|
||||
if the_set is None:
|
||||
return "None"
|
||||
else:
|
||||
|
@ -235,7 +240,7 @@ def terms_plot_top_data():
|
|||
position['month'] = position['month']+1 if position['month'] is not None else "<20"
|
||||
value_range = []
|
||||
for timestamp in range(today_timestamp, today_timestamp - num_day*oneDay, -oneDay):
|
||||
value = r_serv_term.hget(timestamp, term)
|
||||
value = r_serv_term.hget(per_paste+str(timestamp), term)
|
||||
curr_value_range = int(value) if value is not None else 0
|
||||
value_range.append([timestamp, curr_value_range])
|
||||
|
||||
|
|
|
@ -116,21 +116,19 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for term in track_list %}
|
||||
<tr>
|
||||
<td>{{ term }}</td>
|
||||
<td>{{ track_list_values[i][3] }}</td>
|
||||
<td>{{ track_list_values[i][0] }}</td>
|
||||
<td>{{ track_list_values[i][1] }}</td>
|
||||
<td>{{ track_list_values[i][2] }}</td>
|
||||
<td>{{ track_list_num_of_paste[i] }}</td>
|
||||
<td>{{ track_list_values[loop.index0][3] }}</td>
|
||||
<td>{{ track_list_values[loop.index0][0] }}</td>
|
||||
<td>{{ track_list_values[loop.index0][1] }}</td>
|
||||
<td>{{ track_list_values[loop.index0][2] }}</td>
|
||||
<td>{{ track_list_num_of_paste[loop.index0] }}</td>
|
||||
<td><p style="margin: 0px;">
|
||||
<span data-toggle="modal" data-target="#mymodal" data-term="{{ term }}" ><button class="btn-link" data-toggle="tooltip" data-placement="right" title="Show concerned paste(s)"><span class="glyphicon glyphicon-info-sign"></span></button></span>
|
||||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="left" title="Remove this term" data-content="{{ term }}" data-section="followTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
</p></td>
|
||||
</tr>
|
||||
{% set i = i + 1 %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -162,22 +160,20 @@
|
|||
<table class="table table-striped table-bordered table-hover" id="myTable2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="max-width: 800px;">Termx</th>
|
||||
<th style="max-width: 800px;">Term</th>
|
||||
<th>Added date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set i = 0 %}
|
||||
{% for term in black_list %}
|
||||
{% for term, date in black_list %}
|
||||
<tr>
|
||||
<td>{{ black_list[i][0] }}</td>
|
||||
<td>{{ black_list[i][1] }}</td>
|
||||
<td>{{ term }}</td>
|
||||
<td>{{ date }}</td>
|
||||
<td><p style="margin: 0px;">
|
||||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="right" title="Remove this term" data-content="{{ black_list[i][0] }}" data-section="blacklistTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="right" title="Remove this term" data-content="{{ term }}" data-section="blacklistTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
</p></td>
|
||||
</tr>
|
||||
{% set i = i + 1 %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ url_for('static', filename='css/switch_checkbox.css') }}" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
|
||||
|
@ -67,9 +68,14 @@
|
|||
<div class="col-lg-12">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form>
|
||||
<input type="checkbox" id="per_paste" value="per_paste" onclick="reload_per_paste()"> 1 term per paste
|
||||
</form>
|
||||
<div class='pull_right'>
|
||||
<label class="switch">
|
||||
<input id="per_paste" class="switch-input" value="per_paste" type="checkbox" onclick="reload_per_paste()">
|
||||
<span class="switch-label" data-on="On" data-off="Off"></span>
|
||||
<span class="switch-handle"></span>
|
||||
</label>
|
||||
<strong style="top: 3px; position: relative;">1 term per paste</strong>
|
||||
<div>
|
||||
<div id="panel-today" class="panel panel-info">
|
||||
<div class="panel-heading">
|
||||
<strong>Today</strong>
|
||||
|
|
Loading…
Reference in a new issue