diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-30 13:04:30 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-01-05 13:23:57 +0200 |
| commit | 16f40ddbfe483fef01a9623ec584e5f08a863d22 (patch) | |
| tree | 98f1587067fe00abed76aad95ecb418f36749fef /src/client/textanalysis.js | |
| parent | 54aa65a3dab029f28741875eb11a40adb06aff51 (diff) | |
wip fixes from week 52 refactor
Diffstat (limited to 'src/client/textanalysis.js')
| -rw-r--r-- | src/client/textanalysis.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js index 8ee4b05f..bd435804 100644 --- a/src/client/textanalysis.js +++ b/src/client/textanalysis.js @@ -483,14 +483,14 @@ var textAnalyser = function (newtext, finalize) { graph.removeLinks("temp"); if (!finalize) { // finalize done via topo diff below - ret.for_each_node_add(function (node) { + ret.for_each_node_add(function (node_spec) { + var new_node; if (true == finalize && node.state == 'temp') { console.log('bug: temp node creation on finalize'); } else { + new_node = graph.addTempNode(node_spec); if (!finalize) { - lastnode = graph.addNode(node); - } else { - graph.addNode(node); + lastnode = new_node; } } }); @@ -512,15 +512,17 @@ var textAnalyser = function (newtext, finalize) { graph.removeRelated(); } + // drop bubble node + ret.node_set_add = ret.node_set_add.filter(function(n) { return n.type != 'bubble'; }); + // drop and links + ret.link_set_add = ret.link_set_add.filter(function(l) { return l.name !== 'and'; }); if (finalize && backend_commit) { // broadcast diff: // - finalize? // - broadcast_diff requested by caller - // drop bubble node - ret.node_set_add = ret.node_set_add.filter(function(n) { return n.type != 'bubble'; }); - // drop and links - ret.link_set_add = ret.link_set_add.filter(function(l) { return l.name !== 'and'; }); - graph.commit_and_tx__topo(ret); + graph.commit_and_tx_diff__topo(ret); + } else { + graph.commit_diff__topo(ret); } }; |
