From 193f47b9b5b090c1da31372c56b32086a2d74490 Mon Sep 17 00:00:00 2001 From: legutierr Date: Mon, 2 Jan 2017 10:45:26 -0500 Subject: [PATCH] Fixes problem where package weight was dropped When new package instances were being created, the weight value was not being preserved. This repairs the problem. --- pyshipping/binpack_simple.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyshipping/binpack_simple.py b/pyshipping/binpack_simple.py index 89c4fdb..e63f756 100644 --- a/pyshipping/binpack_simple.py +++ b/pyshipping/binpack_simple.py @@ -166,8 +166,10 @@ def allpermutations_helper(permuted, todo, maxcounter, callback, bin, bestpack, else: others = todo[1:] thispackage = todo[0] + weight = thispackage.weight for dimensions in set(permutations((thispackage[0], thispackage[1], thispackage[2]))): thispackage = Package(dimensions, nosort=True) + thispackage.weight = weight if thispackage in bin: counter = allpermutations_helper(permuted + [thispackage], others, maxcounter, callback, bin, bestpack, counter)