Review: Needs Fixing

The current call is far too complex (and I'm pretty sure there are mistakes in 
it as well, but I'm not going to bother looking too hard): you can just chain a 
`uniq` call with a transformation function (see documentation[0]) to the 
existing `filter` call in order to uniquify the list current of subflows, 
something along the lines of:

    self.process_subflows = _(res.nodes).chain()
        .filter(function (node) { return node['subflow'] !== false; })
        .uniq(false, function (node) { return node['subflow'][0]; })
        .value();

Note underscore's chaining which (I think) makes the code more readable by 
building a "pipeline" of transformations on the original sequence instead of 
nesting the calls.

[0] http://documentcloud.github.com/underscore/#uniq
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-906073-vja/+merge/86668
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-bug-906073-vja.

_______________________________________________
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