From e6dead2e27f18a068f989e79268f623f599e0c36 Mon Sep 17 00:00:00 2001 From: Resin Neublem Date: Sun, 20 Nov 2016 15:25:30 -0500 Subject: [PATCH] Groups drones before generating DNA Drones can and often are in different stacks due to bandwidth and skills. The DNA would mess up in these cases because they would include duplicate ids with different numbers. This commit groups the drones by the itemID before generating the DNA. closes: https://github.com/pyfa-org/Pyfa/issues/367 --- service/port.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service/port.py b/service/port.py index 2a8972dd7..a9b4089c7 100644 --- a/service/port.py +++ b/service/port.py @@ -792,8 +792,13 @@ class Port(object): for mod in mods: dna += ":{0};{1}".format(mod, mods[mod]) + # drones are known to be in split stacks + groupedDrones = OrderedDict() for drone in fit.drones: - dna += ":{0};{1}".format(drone.itemID, drone.amount) + groupedDrones[drone.itemID] = groupedDrones.get(drone.itemID, 0) + drone.amount + + for droneItemID in groupedDrones: + dna += ":{0};{1}".format(droneItemID, groupedDrones[droneItemID]) for cargo in fit.cargo: # DNA format is a simple/dumb format. As CCP uses the slot information of the item itself