[ms planning] fix bug in merge_input_map causing bad plans computed
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 26 Oct 2010 20:21:48 +0200
changeset 6650 72f2fd93a622
parent 6649 29f8e5c35392
child 6651 4a0283b3ce0c
[ms planning] fix bug in merge_input_map causing bad plans computed
server/msplanner.py
--- a/server/msplanner.py	Tue Oct 26 20:21:09 2010 +0200
+++ b/server/msplanner.py	Tue Oct 26 20:21:48 2010 +0200
@@ -1108,14 +1108,17 @@
         """
         if not self._inputmaps:
             return [(allsolindices, None)]
+        _allsolindices = allsolindices.copy()
         mapbysol = {}
         # compute a single map for each solution
         for solindices, basemap in self._inputmaps.iteritems():
             for solindex in solindices:
+                if not solindex in allsolindices:
+                    continue
                 solmap = mapbysol.setdefault(solindex, {})
                 solmap.update(basemap)
                 try:
-                    allsolindices.remove(solindex)
+                    _allsolindices.remove(solindex)
                 except KeyError:
                     continue # already removed
         # group results by identical input map
@@ -1127,8 +1130,8 @@
                     break
             else:
                 result.append( ([solindex], solmap) )
-        if allsolindices:
-            result.append( (list(allsolindices), None) )
+        if _allsolindices:
+            result.append( (list(_allsolindices), None) )
         return result
 
     def build_final_part(self, select, solindices, inputmap,  sources,