Commit 287acbce authored by delanoe's avatar delanoe

Merge branch 'samuel' into unstable

parents c8ba3051 3cc57608
...@@ -601,8 +601,18 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -601,8 +601,18 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
} else callback(false); } else callback(false);
} }
function Main_test( data , initial) { function Main_test( data , initial , search_filter) {
console.log("")
console.log(" = = = = MAIN_TEST: = = = = ")
console.log("data:")
console.log(data)
console.log("initial:")
console.log(initial)
console.log("search_filter:")
console.log(search_filter)
console.log(" = = = = / MAIN_TEST: = = = = ")
console.log("")
var DistributionDict = {} var DistributionDict = {}
for(var i in DistributionDict) for(var i in DistributionDict)
...@@ -610,8 +620,6 @@ function Main_test( data , initial) { ...@@ -610,8 +620,6 @@ function Main_test( data , initial) {
delete DistributionDict; delete DistributionDict;
DistributionDict = {} DistributionDict = {}
AjaxRecords = []
var FirstScore = initial; var FirstScore = initial;
var arrayd3 = [] var arrayd3 = []
...@@ -640,6 +648,7 @@ function Main_test( data , initial) { ...@@ -640,6 +648,7 @@ function Main_test( data , initial) {
div_stats += "</p>" div_stats += "</p>"
$("#stats").html(div_stats) $("#stats").html(div_stats)
AjaxRecords = []
for(var i in data.ngrams) { for(var i in data.ngrams) {
var le_ngram = data.ngrams[i] var le_ngram = data.ngrams[i]
...@@ -647,7 +656,6 @@ function Main_test( data , initial) { ...@@ -647,7 +656,6 @@ function Main_test( data , initial) {
var orig_id = le_ngram.id var orig_id = le_ngram.id
var arr_id = parseInt(i) var arr_id = parseInt(i)
RecDict[orig_id] = arr_id; RecDict[orig_id] = arr_id;
var node_info = { var node_info = {
"id" : le_ngram.id, "id" : le_ngram.id,
"name": le_ngram.name, "name": le_ngram.name,
...@@ -663,6 +671,8 @@ function Main_test( data , initial) { ...@@ -663,6 +671,8 @@ function Main_test( data , initial) {
DistributionDict[node_info.score]++; DistributionDict[node_info.score]++;
} }
console.log(FirstScore)
// console.log("The Distribution!:") // console.log("The Distribution!:")
// console.log(Distribution) // console.log(Distribution)
var DistributionList = [] var DistributionList = []
...@@ -829,7 +839,7 @@ function Main_test( data , initial) { ...@@ -829,7 +839,7 @@ function Main_test( data , initial) {
$("#filter_search").html( $("#filter_search").html().replace('selected="selected"') ); $("#filter_search").html( $("#filter_search").html().replace('selected="selected"') );
$("#filter_all").attr( "selected" , "selected" ) $("#"+search_filter).attr( "selected" , "selected" )
var the_content = $("#filter_search").html(); var the_content = $("#filter_search").html();
$(""+the_content).insertAfter("#dynatable-query-search-my-ajax-table") $(""+the_content).insertAfter("#dynatable-query-search-my-ajax-table")
return "OK" return "OK"
...@@ -841,16 +851,41 @@ function SearchFilters( elem ) { ...@@ -841,16 +851,41 @@ function SearchFilters( elem ) {
var MODE = elem.value; var MODE = elem.value;
if( MODE == "filter_all") { if( MODE == "filter_all") {
var result = Main_test(AjaxRecords , MODE) console.clear()
var result = Main_test( ngrams_data , ngrams_data.scores.initial , MODE)
console.log( result ) console.log( result )
MyTable.data('dynatable').sorts.clear();
MyTable.data('dynatable').sorts.add('score', 0) // 1=ASCENDING,
MyTable.data('dynatable').process();
} }
if( MODE == "filter_map-list") { if( MODE == "filter_map-list") {
console.clear()
console.log("ngrams_map:")
console.log(ngrams_map)
var sub_ngrams_data = {
"ngrams":[],
"scores": $.extend({}, ngrams_data.scores)
}
for(var r in ngrams_data.ngrams) {
if ( ngrams_map[ngrams_data.ngrams[r].id] ) {
sub_ngrams_data["ngrams"].push( ngrams_data.ngrams[r] )
}
}
var result = Main_test(sub_ngrams_data , ngrams_data.scores.initial , MODE)
console.log( result )
// MyTable.data('dynatable').sorts.clear();
// MyTable.data('dynatable').sorts.add('score', 0) // 1=ASCENDING,
// MyTable.data('dynatable').process();
} }
if( MODE == "filter_stop-list") { if( MODE == "filter_stop-list") {
console.clear()
console.log("ngrams_stop:")
console.log( {} )
} }
} }
...@@ -946,7 +981,8 @@ $.when( ...@@ -946,7 +981,8 @@ $.when(
} }
} }
// Initializing the Charts and Table // Initializing the Charts and Table
var result = Main_test( ngrams_data , FirstScore ) console.log( ngrams_data )
var result = Main_test( ngrams_data , FirstScore , "filter_all")
console.log( result ) console.log( result )
// Listener for onchange Score-Selector // Listener for onchange Score-Selector
...@@ -954,8 +990,9 @@ $.when( ...@@ -954,8 +990,9 @@ $.when(
$("#ScoresBox").html(scores_div) $("#ScoresBox").html(scores_div)
$("#scores_selector").on('change', function() { $("#scores_selector").on('change', function() {
console.log( this.value ) console.log( this.value )
var result = Main_test( ngrams_data , this.value ) var result = Main_test( ngrams_data , this.value , "filter_all")
console.log( result ) console.log( result )
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment