Added comments

This commit is contained in:
Mokaddem 2016-08-26 10:28:35 +02:00
parent 494980c48e
commit 4cb3b672be
2 changed files with 13 additions and 3 deletions

View file

@ -227,6 +227,12 @@ function create_queue_table() {
td.appendChild(document.createTextNode(glob_tabvar.row1[i][j] + moduleNum)); td.appendChild(document.createTextNode(glob_tabvar.row1[i][j] + moduleNum));
tr.appendChild(td) tr.appendChild(td)
} }
// Used to decide the color of the row
// We have glob_tabvar.row1[][j] with:
// - j=0: ModuleName
// - j=1: queueLength
// - j=2: LastProcessedPasteTime
// - j=3: Number of the module belonging in the same category
if (parseInt(glob_tabvar.row1[i][2]) > 60*2 && parseInt(glob_tabvar.row1[i][1]) > 2) if (parseInt(glob_tabvar.row1[i][2]) > 60*2 && parseInt(glob_tabvar.row1[i][1]) > 2)
tr.className += " danger"; tr.className += " danger";
else if (parseInt(glob_tabvar.row1[i][2]) > 60*1) else if (parseInt(glob_tabvar.row1[i][2]) > 60*1)

View file

@ -96,6 +96,9 @@ var all_data = [];
var provider_already_loaded = []; var provider_already_loaded = [];
var totNumGraph = 0; var totNumGraph = 0;
// Query all providers name then launch the query and plot process for each of them.
// When everything is terminated, plot the widgets (Gauge, canvasJS, table)
// input: all - set to 'True' if you take all providers
function draw_page(all) { function draw_page(all) {
$.getJSON("/sentiment_analysis_getplotdata/?getProviders=True&all="+all, $.getJSON("/sentiment_analysis_getplotdata/?getProviders=True&all="+all,
function(data) { function(data) {
@ -130,7 +133,9 @@ function draw_page(all) {
} }
// Query data and plot it for a given provider
// input - provider: The povider name to be plotted
// input - graphNum: The number of the graph (Use to plot on correct div)
function query_and_plot(provider, graphNum) { function query_and_plot(provider, graphNum) {
var query_plot = $.getJSON("/sentiment_analysis_getplotdata/?provider="+provider, var query_plot = $.getJSON("/sentiment_analysis_getplotdata/?provider="+provider,
function(data) { function(data) {
@ -186,8 +191,7 @@ function query_and_plot(provider, graphNum) {
max_value = Math.abs(pos-neg) > max_value ? Math.abs(pos-neg) : max_value; max_value = Math.abs(pos-neg) > max_value ? Math.abs(pos-neg) : max_value;
if(curr_date >= dateStart+oneWeek-23*oneHour){ if(curr_date >= dateStart+oneWeek-23*oneHour){
max_value_day = Math.abs(pos-neg) > max_value_day ? Math.abs(pos-neg) : max_value_day; max_value_day = Math.abs(pos-neg) > max_value_day ? Math.abs(pos-neg) : max_value_day; day_sum += (pos-neg);
day_sum += (pos-neg);
day_sum_elem++; day_sum_elem++;
} }
if(curr_date > dateStart+oneWeek-2*oneHour && curr_date <=dateStart+oneWeek-oneHour){ if(curr_date > dateStart+oneWeek-2*oneHour && curr_date <=dateStart+oneWeek-oneHour){