Review: Needs Fixing

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`.

-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-1011492-pan/+merge/120487
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-bug-1011492-pan.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to