Merge lp:~openerp-dev/openerp-web/trunk-bug-1011492-pan into lp:openerp-web

Proposed by Jiten (OpenERP)
Status: Rejected
Rejected by: Nicolas Vanhoren (OpenERP)
Proposed branch: lp:~openerp-dev/openerp-web/trunk-bug-1011492-pan
Merge into: lp:openerp-web
Diff against target: 16 lines (+3/-2)
1 file modified
addons/web_graph/static/src/js/graph.js (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-bug-1011492-pan
Reviewer Review Type Date Requested Status
Xavier (Open ERP) Pending
Jiten (OpenERP) Pending
Review via email: mp+122488@code.launchpad.net

This proposal supersedes a proposal from 2012-08-21.

To post a comment you must log in.
Revision history for this message
Jiten (OpenERP) (jiten-openerp) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote : Posted in a previous version of this proposal

Looking at that code, it bothers me that the behavior seems arbitrary and lucky, it makes the error disappear but doesn't actually fix it: it's relying on the implementation behavior of min wrt `undefined`, and then relies on the inequality test wrt 0 for the definition of the axis min values.

The way I'd see to do that, _.min returns ``undefined`` if the list of values is empty, instead of pre-testing and returning some arbitrary value use [null, Infinity] as the inner min

    var record_min = _.min(record.data, function (item) {
        return item[1];
    }) || [null, Infinity];
    return record_min[1];

this ensures the second member is as big as can be, and will always correctly behave in other mins, and in comparisons with `0`.

review: Needs Fixing
Revision history for this message
Nicolas Vanhoren (OpenERP) (niv-openerp) wrote :

No more useful fix because the problem does not appear any more.

Unmerged revisions

2885. By Anand

[IMP]I have updated the code as suggested

2884. By Anand

[MERGE]Merged from openerp-web

2883. By Anand

[FIX]fixes the dashboard problem for the sales and hr graph

2882. By Anand

[MERGE]Merged from openerp web

2881. By Anand

[MERGE]Merged from openerp web

2880. By Anand

[MERGE]mergerd form openerp-web

2879. By Anand

[MERGE]merged from openerp-web

2878. By Anand

[MERGE] merged from the openerp-web

2877. By Anand

[MERGE]merged from openerp-web

2876. By Anand

[IMP]updated code for sales and hr graph

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web_graph/static/src/js/graph.js'
2--- addons/web_graph/static/src/js/graph.js 2012-08-24 18:27:07 +0000
3+++ addons/web_graph/static/src/js/graph.js 2012-09-03 10:35:44 +0000
4@@ -142,9 +142,10 @@
5 options_bar: function (data) {
6 var min = _(data.data).chain()
7 .map(function (record) {
8- return _.min(record.data, function (item) {
9+ var record_min = _.min(record.data, function (item) {
10 return item[1];
11- })[1];
12+ }) || [null, Infinity];
13+ return record_min[1];
14 }).min().value();
15 return {
16 bars : {