summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/pivot_table.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-04-09 11:39:20 +0200
committerGery Debongnie <ged@openerp.com>2014-04-09 11:39:20 +0200
commit1330bb615e7f42a130b578f0ab79be7c0fa1765e (patch)
tree24e0d69b1106fea5b4977554a9b6468478c7daab /addons/web_graph/static/src/js/pivot_table.js
parent05ec7d45bacfdd9dd9b907f1987064e4d2695b9d (diff)
[IMP] massive optimization of the graph view code: more efficient access to values and smarter code to avoid reading uselessly many cells (graph view in web_graph)
bzr revid: ged@openerp.com-20140409093920-xqls2o6j6tocgf6l
Diffstat (limited to 'addons/web_graph/static/src/js/pivot_table.js')
-rw-r--r--addons/web_graph/static/src/js/pivot_table.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/web_graph/static/src/js/pivot_table.js b/addons/web_graph/static/src/js/pivot_table.js
index d0867ca6d1a..d53c972a742 100644
--- a/addons/web_graph/static/src/js/pivot_table.js
+++ b/addons/web_graph/static/src/js/pivot_table.js
@@ -81,10 +81,15 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({
},
get_values: function (id1, id2, default_values) {
- var cell = _.findWhere(this.cells, {x: Math.min(id1, id2), y: Math.max(id1, id2)});
- return (cell !== undefined) ?
- cell.values :
- (default_values || new Array(this.measures.length));
+ var cells = this.cells,
+ x = Math.min(id1, id2),
+ y = Math.max(id1, id2);
+ for (var i = 0; i < cells.length; i++) {
+ if (cells[i].x == x && cells[i].y == y) {
+ return cells[i].values;
+ }
+ }
+ return (default_values || new Array(this.measures.length));
},
// ----------------------------------------------------------------------