Permalink
Browse files

Update autotargeter.py for target service change

  • Loading branch information...
1 parent 5c044c7 commit 3791ee3b1cf2b63d3a4a5183e71ec33d95dd7787 @kg committed Jan 31, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 AutoTargeter/autotargeter.py
@@ -153,6 +153,9 @@ def updateTargets(self):
targetSvc = sm.services.get('target', None)
if not targetSvc:
return
+
+ targetSvc_targeting = [long(k) for k in targetSvc.targeting.keys()]
+ targetSvc_autoTargeting = [long(k) for k in targetSvc.autoTargeting]
maxTargets = self.getMaxTargets()
if maxTargets <= 0:
@@ -167,18 +170,18 @@ def updateTargets(self):
currentTargets = [self.__balls.get(id, None) for id in self.__lockedTargets
if id in targetSvc.targets]
currentTargets = [bi.id for bi in self.filterTargets(currentTargets, gp, gd)]
- exclusionSet = set(targetSvc.targeting + targetSvc.autoTargeting + currentTargets)
+ exclusionSet = set(targetSvc_targeting + targetSvc_autoTargeting + currentTargets)
targetSorter = self.makeTargetSorter(exclusionSet, gp, gd)
targets = self.filterTargets(self.__eligibleBalls, gp, gd)
targets.sort(targetSorter)
currentlyTargeting = set([
- id for id in (targetSvc.targeting + targetSvc.autoTargeting)
+ id for id in (targetSvc_targeting + targetSvc_autoTargeting)
if id in self.__lockedTargets
])
- allLockedTargets = set(targetSvc.targeting + targetSvc.autoTargeting + targetSvc.targets)
+ allLockedTargets = set(targetSvc_targeting + targetSvc_autoTargeting + targetSvc.targets)
maxNewTargets = max(maxTargets - len(allLockedTargets), 0)
targets = set([bi.id for bi in targets[0:maxAutoTargets]])

0 comments on commit 3791ee3

Please sign in to comment.