Commit 0c1c3043 authored by Romain Loth's avatar Romain Loth

cleaning up comments etc

parent 1f3219c9
...@@ -330,8 +330,8 @@ function Main_test(Data) { ...@@ -330,8 +330,8 @@ function Main_test(Data) {
var t1 = get_node_date(AjaxRecords.slice(-1)[0]); var t1 = get_node_date(AjaxRecords.slice(-1)[0]);
oldest = t0; oldest = t0;
latest = t1; latest = t1;
console.log('t0, t1') // console.log('t0, t1')
console.log(t0, t1) // console.log(t0, t1)
TheBuffer = [t0, t1]; TheBuffer = [t0, t1];
TheBuffer[0] = new Date(TheBuffer[0].setDate(TheBuffer[0].getDate()-1) ); TheBuffer[0] = new Date(TheBuffer[0].setDate(TheBuffer[0].getDate()-1) );
...@@ -363,7 +363,7 @@ function Main_test(Data) { ...@@ -363,7 +363,7 @@ function Main_test(Data) {
return d.month; return d.month;
}); });
console.warn(moveMonths) // console.warn(moveMonths)
//moveChart:(3) //moveChart:(3)
var monthlyMoveGroup = moveMonths.group().reduceSum(function (d) { var monthlyMoveGroup = moveMonths.group().reduceSum(function (d) {
...@@ -645,6 +645,7 @@ $.ajax({ ...@@ -645,6 +645,7 @@ $.ajax({
var result = Main_test(maindata.records) var result = Main_test(maindata.records)
// OK ?
console.log( result ) console.log( result )
}, },
}); });
......
...@@ -449,7 +449,7 @@ function saveActiveGroup() { ...@@ -449,7 +449,7 @@ function saveActiveGroup() {
// clean group modification zone and buffer and update table // clean group modification zone and buffer and update table
removeActiveGroupFrameAndUpdate() removeActiveGroupFrameAndUpdate()
console.log("after changes, GroupsBuffer: ",GroupsBuffer) // console.log("after changes, GroupsBuffer: ",GroupsBuffer)
} }
function removeActiveGroupFrameAndUpdate() { function removeActiveGroupFrameAndUpdate() {
...@@ -471,7 +471,7 @@ function removeActiveGroupFrameAndUpdate() { ...@@ -471,7 +471,7 @@ function removeActiveGroupFrameAndUpdate() {
// TODO when several scores, use cache like currentStateFilter // TODO when several scores, use cache like currentStateFilter
var FirstScore = OriginalNG.scores.initial var FirstScore = OriginalNG.scores.initial
console.log("full re-create table") // console.log("full re-create table")
MainTableAndCharts(AjaxRecords, FirstScore , currentStateFilter) MainTableAndCharts(AjaxRecords, FirstScore , currentStateFilter)
} }
...@@ -863,7 +863,7 @@ function deleteInCurrentGroups(becomesFree, mainformId, subforms) { ...@@ -863,7 +863,7 @@ function deleteInCurrentGroups(becomesFree, mainformId, subforms) {
* @param subforms array of subNgramIds * @param subforms array of subNgramIds
*/ */
function addInCurrentGroups(mainformId, subforms) { function addInCurrentGroups(mainformId, subforms) {
console.log("addInCurrentGroups: "+mainformId+"("+JSON.stringify(subforms)+")") // console.log("addInCurrentGroups: "+mainformId+"("+JSON.stringify(subforms)+")")
CurrentGroups["links"][mainformId] = subforms CurrentGroups["links"][mainformId] = subforms
for (var i in subforms) { for (var i in subforms) {
var subformId = subforms[i] var subformId = subforms[i]
...@@ -1199,7 +1199,7 @@ function ulWriter(rowIndex, record, columns, cellWriter) { ...@@ -1199,7 +1199,7 @@ function ulWriter(rowIndex, record, columns, cellWriter) {
//debug //debug
if( typeof AjaxRecords[record.id] == "undefined") { if( typeof AjaxRecords[record.id] == "undefined") {
console.log('/!\\ nothing for ' + record.id) console.warn('/!\\ nothing for ' + record.id)
return false; return false;
} }
// erase state <= 0 // erase state <= 0
...@@ -1413,10 +1413,10 @@ function InferCRUDFlags(id, oldState, desiredState, registry) { ...@@ -1413,10 +1413,10 @@ function InferCRUDFlags(id, oldState, desiredState, registry) {
// thus skips newly grouped items and returns unmodified registry // thus skips newly grouped items and returns unmodified registry
if (desiredState != state_skip) { if (desiredState != state_skip) {
console.log(oldState,"==>", desiredState) // console.log(oldState,"==>", desiredState)
// (if was previously in MAP) // (if was previously in MAP)
if (oldState === state_map) { if (oldState === state_map) {
console.log("previously in map:" + id + "("+AjaxRecords[id]['name']+")") // console.log("previously in map:" + id + "("+AjaxRecords[id]['name']+")")
if (desiredState === state_main || desiredState === state_stop) { if (desiredState === state_main || desiredState === state_stop) {
registry["outmap"][ id ] = true registry["outmap"][ id ] = true
// (... and some more actions only if is now desired to be in STOP) // (... and some more actions only if is now desired to be in STOP)
...@@ -1428,7 +1428,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) { ...@@ -1428,7 +1428,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) {
} }
// (if previously was in STOP) // (if previously was in STOP)
else if (oldState === state_stop) { else if (oldState === state_stop) {
console.log("previously in stop:" + id + "("+AjaxRecords[id]['name']+")") // console.log("previously in stop:" + id + "("+AjaxRecords[id]['name']+")")
if (desiredState === state_main || desiredState === state_map) { if (desiredState === state_main || desiredState === state_map) {
registry["outdel"][id] = true registry["outdel"][id] = true
registry["inmain"][id] = true registry["inmain"][id] = true
...@@ -1441,7 +1441,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) { ...@@ -1441,7 +1441,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) {
// (if previously was under a group) // (if previously was under a group)
else if (oldState === state_skip) { else if (oldState === state_skip) {
if (desiredState === state_main || desiredState === state_map) { if (desiredState === state_main || desiredState === state_map) {
console.warn("enter free record:" + id + "("+AjaxRecords[id]['name']+")") // console.log("previously hidden in group:" + id + "("+AjaxRecords[id]['name']+")")
registry["inmain"][id] = true registry["inmain"][id] = true
// (... and one more action only if is now desired to be in MAP) // (... and one more action only if is now desired to be in MAP)
if(desiredState === state_map) { if(desiredState === state_map) {
...@@ -1477,7 +1477,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) { ...@@ -1477,7 +1477,7 @@ function InferCRUDFlags(id, oldState, desiredState, registry) {
// Save changes to all corpusA-lists // Save changes to all corpusA-lists
function SaveLocalChanges() { function SaveLocalChanges() {
// console.clear() // console.clear()
console.log("In SaveLocalChanges()") // console.log("In SaveLocalChanges()")
// registry with summary of the requested changes with consequences // registry with summary of the requested changes with consequences
// ------------------------------------------------------------------ // ------------------------------------------------------------------
...@@ -1506,7 +1506,7 @@ function SaveLocalChanges() { ...@@ -1506,7 +1506,7 @@ function SaveLocalChanges() {
if (OriginalNG["map"][ id ] ) oldState = 1 if (OriginalNG["map"][ id ] ) oldState = 1
else if (OriginalNG["stop"][ id ]) oldState = 2 else if (OriginalNG["stop"][ id ]) oldState = 2
else if (typeof oldState == "undefined") { else if (typeof oldState == "undefined") {
console.warn('old state in OriginalNG not defined but not map nor stop: (id:' + id +')') console.error('old state in OriginalNG not defined but not map nor stop: (id:' + id +')')
oldState = 0 ; oldState = 0 ;
} }
...@@ -1576,7 +1576,7 @@ function SaveLocalChanges() { ...@@ -1576,7 +1576,7 @@ function SaveLocalChanges() {
// add some ngrams to maplist // add some ngrams to maplist
function CRUD_1_AddMap() { function CRUD_1_AddMap() {
console.log("===> AJAX CRUD1 AddMap <===\n") ; console.log("AJAX CRUD1 AddMap") ;
CRUD( maplist_id , Object.keys(FlagsBuffer["inmap"]), "PUT" , function(success) { CRUD( maplist_id , Object.keys(FlagsBuffer["inmap"]), "PUT" , function(success) {
if (success) { if (success) {
CRUD_2_RmMap() // trigger chained AJAX 1 -> 2 CRUD_2_RmMap() // trigger chained AJAX 1 -> 2
...@@ -1588,7 +1588,7 @@ function SaveLocalChanges() { ...@@ -1588,7 +1588,7 @@ function SaveLocalChanges() {
} }
// remove some ngrams from maplist // remove some ngrams from maplist
function CRUD_2_RmMap() { function CRUD_2_RmMap() {
console.log("===> AJAX CRUD2 RmMap <===\n") ; console.log("AJAX CRUD2 RmMap") ;
CRUD( maplist_id , Object.keys(FlagsBuffer["outmap"]), "DELETE" , function(success) { CRUD( maplist_id , Object.keys(FlagsBuffer["outmap"]), "DELETE" , function(success) {
if (success) { if (success) {
CRUD_3_AddMain() // chained AJAX 2 -> 3 CRUD_3_AddMain() // chained AJAX 2 -> 3
...@@ -1600,7 +1600,7 @@ function SaveLocalChanges() { ...@@ -1600,7 +1600,7 @@ function SaveLocalChanges() {
} }
// add some ngrams to mainlist // add some ngrams to mainlist
function CRUD_3_AddMain() { function CRUD_3_AddMain() {
console.log("===> AJAX CRUD3 AddMain <===\n") ; console.log("AJAX CRUD3 AddMain") ;
CRUD( mainlist_id , Object.keys(FlagsBuffer["inmain"]), "PUT" , function(success) { CRUD( mainlist_id , Object.keys(FlagsBuffer["inmain"]), "PUT" , function(success) {
if (success) { if (success) {
CRUD_4_RmMain() // chained AJAX 3 -> 4 CRUD_4_RmMain() // chained AJAX 3 -> 4
...@@ -1612,7 +1612,7 @@ function SaveLocalChanges() { ...@@ -1612,7 +1612,7 @@ function SaveLocalChanges() {
} }
// remove some ngrams from mainlist // remove some ngrams from mainlist
function CRUD_4_RmMain() { function CRUD_4_RmMain() {
console.log("===> AJAX CRUD4 RmMain <===\n") ; console.log("AJAX CRUD4 RmMain") ;
CRUD( mainlist_id , Object.keys(FlagsBuffer["outmain"]), "DELETE" , function(success) { CRUD( mainlist_id , Object.keys(FlagsBuffer["outmain"]), "DELETE" , function(success) {
if (success) { if (success) {
CRUD_5_AddStop() // chained AJAX 4 -> 5 CRUD_5_AddStop() // chained AJAX 4 -> 5
...@@ -1624,7 +1624,7 @@ function SaveLocalChanges() { ...@@ -1624,7 +1624,7 @@ function SaveLocalChanges() {
} }
// add some ngrams to stoplist // add some ngrams to stoplist
function CRUD_5_AddStop() { function CRUD_5_AddStop() {
console.log("===> AJAX CRUD5 AddStop <===\n") ; console.log("AJAX CRUD5 AddStop") ;
CRUD( stoplist_id , Object.keys(FlagsBuffer["indel"]), "PUT" , function(success) { CRUD( stoplist_id , Object.keys(FlagsBuffer["indel"]), "PUT" , function(success) {
if (success) { if (success) {
CRUD_6_RmStop() // chained AJAX 5 -> 6 CRUD_6_RmStop() // chained AJAX 5 -> 6
...@@ -1636,7 +1636,7 @@ function SaveLocalChanges() { ...@@ -1636,7 +1636,7 @@ function SaveLocalChanges() {
} }
// remove some ngrams from stoplist // remove some ngrams from stoplist
function CRUD_6_RmStop() { function CRUD_6_RmStop() {
console.log("===> AJAX CRUD6 RmStop <===\n") ; console.log("AJAX CRUD6 RmStop") ;
CRUD( stoplist_id , Object.keys(FlagsBuffer["outdel"]), "DELETE" , function(success) { CRUD( stoplist_id , Object.keys(FlagsBuffer["outdel"]), "DELETE" , function(success) {
if (success) { if (success) {
CRUD_7_AddGroups() // chained AJAX 6 -> 7 CRUD_7_AddGroups() // chained AJAX 6 -> 7
...@@ -1649,7 +1649,7 @@ function SaveLocalChanges() { ...@@ -1649,7 +1649,7 @@ function SaveLocalChanges() {
// add to groups reading data from GroupsBuffer // add to groups reading data from GroupsBuffer
// (also removes previous groups with same mainforms!) // (also removes previous groups with same mainforms!)
function CRUD_7_AddGroups() { function CRUD_7_AddGroups() {
console.log("===> AJAX CRUD7 AddGroups <===\n") ; console.log("AJAX CRUD7 AddGroups") ;
GROUPCRUDS(groupnode_id, GroupsBuffer._to_add, "PUT" , function(success) { GROUPCRUDS(groupnode_id, GroupsBuffer._to_add, "PUT" , function(success) {
if (success) { if (success) {
CRUD_8_RmGroups() // chained AJAX 7 -> 8 CRUD_8_RmGroups() // chained AJAX 7 -> 8
...@@ -1662,7 +1662,7 @@ function SaveLocalChanges() { ...@@ -1662,7 +1662,7 @@ function SaveLocalChanges() {
// add to groups reading data from GroupsBuffer // add to groups reading data from GroupsBuffer
function CRUD_8_RmGroups() { function CRUD_8_RmGroups() {
console.log("===> AJAX CRUD8 RmGroups <===\n") ; console.log("AJAX CRUD8 RmGroups") ;
GROUPCRUDS(groupnode_id, GroupsBuffer._to_del, "DELETE", function(success) { GROUPCRUDS(groupnode_id, GroupsBuffer._to_del, "DELETE", function(success) {
if (success) { if (success) {
window.location.reload() // all 8 CRUDs OK => refresh whole page window.location.reload() // all 8 CRUDs OK => refresh whole page
...@@ -1694,15 +1694,15 @@ function CRUD( list_id , ngram_ids , http_method , callback) { ...@@ -1694,15 +1694,15 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
success: function(data){ success: function(data){
console.log("-- CRUD ----------") console.log("-- CRUD ----------")
console.log(http_method + " ok!!") console.log(http_method + " ok!!")
console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
console.log("------------------") // console.log("------------------")
callback(true); callback(true);
}, },
error: function(result) { error: function(result) {
console.log("-- CRUD ----------") console.log("-- CRUD ----------")
console.log("AJAX Error on " + http_method + " " + the_url); console.error("AJAX Error on " + http_method + " " + the_url);
console.log(result) // console.log(result)
console.log("------------------") // console.log("------------------")
callback(false); callback(false);
} }
}); });
...@@ -1757,15 +1757,15 @@ function GROUPCRUDS( groupnode_id , send_data, http_method , callback) { ...@@ -1757,15 +1757,15 @@ function GROUPCRUDS( groupnode_id , send_data, http_method , callback) {
success: function(data){ success: function(data){
console.log("-- GROUPCRUD ----------") console.log("-- GROUPCRUD ----------")
console.log(http_method + " ok!!") console.log(http_method + " ok!!")
console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
console.log("-----------------------") // console.log("-----------------------")
callback(true); callback(true);
}, },
error: function(result) { error: function(result) {
console.log("-- GROUPCRUD ----------") console.log("-- GROUPCRUD ----------")
console.log("AJAX Error on " + http_method + " " + the_url); console.error("AJAX Error on " + http_method + " " + the_url);
console.log(result) //console.log(result)
console.log("------------------") //console.log("------------------")
callback(false); callback(false);
} }
}); });
...@@ -1931,12 +1931,7 @@ function MainTableAndCharts( ngdata , initial , search_filter) { ...@@ -1931,12 +1931,7 @@ function MainTableAndCharts( ngdata , initial , search_filter) {
(typeof le_ngram.score == "undefined" || le_ngram.score == null) (typeof le_ngram.score == "undefined" || le_ngram.score == null)
&& (typeof le_ngram.state == "undefined" || (le_ngram.state != 2 && le_ngram.state != -1)) && (typeof le_ngram.state == "undefined" || (le_ngram.state != 2 && le_ngram.state != -1))
) { ) {
console.log("no score for:") console.warn("no score for:" + le_ngram.id, le_ngram.name)
console.log(le_ngram.id)
console.log(le_ngram.name)
console.log(le_ngram)
console.log("\n")
// rec_info["score"] = 4000
} }
// AjaxRecords.push(rec_info) // AjaxRecords.push(rec_info)
......
...@@ -114,6 +114,8 @@ ...@@ -114,6 +114,8 @@
<span class="glyphicon glyphicon-repeat" aria-hidden="true" <span class="glyphicon glyphicon-repeat" aria-hidden="true"
title='Recalculate ngram scores and similarities'></span> title='Recalculate ngram scores and similarities'></span>
</button> </button>
<!-- TODO: delete non seulement si state.complete mais aussi si state.error -->
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content=" data-content="
<ul> <ul>
......
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