Skip to content

Commit

Permalink
re-Wording followPath to more readable, recycle_items.should_run shou…
Browse files Browse the repository at this point in the history
…ld accept <= for min_empty_space: 0 (#4105)

* re-wording follow path, inventory should have -1 value instead of 0

* remove unused

* refactor: inventory.get_space_left should return 0 so change conditions from recycle.should_run instead
  • Loading branch information
fake-or-dead authored and solderzzc committed Aug 16, 2016
1 parent abb8570 commit e68c2e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def work(self):

self.emit_event(
'position_update',
formatted="Walking from {last_position} to {current_position} ({distance} {distance_unit})",
formatted="Walk to {last_position} now at {current_position}, distance left: ({distance} {distance_unit}) ..",
data={
'last_position': (last_lat, last_lng, 0),
'current_position': (lat, lng, 0),
'last_position': (lat, lng, 0),
'current_position': (last_lat, last_lng, 0),
'distance': dist,
'distance_unit': 'm'
}
Expand Down
6 changes: 3 additions & 3 deletions pokemongo_bot/cell_workers/recycle_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def should_run(self):
:return: True if the recycling process should be run; otherwise, False.
:rtype: bool
"""
if inventory.Items.get_space_left() < (DEFAULT_MIN_EMPTY_SPACE if self.min_empty_space is None else self.min_empty_space):
if inventory.Items.get_space_left() <= (DEFAULT_MIN_EMPTY_SPACE if self.min_empty_space is None else self.min_empty_space):
return True
return False

Expand Down Expand Up @@ -165,7 +165,7 @@ def get_category_items_to_recycle(self, category_inventory, category_count, cate
items_to_be_recycled = category_count - category_max

for item in category_inventory:
if items_to_be_recycled == 0:
if items_to_be_recycled == 0:
break
if items_to_be_recycled >= item[1]:
items_to_recycle.append([])
Expand All @@ -175,7 +175,7 @@ def get_category_items_to_recycle(self, category_inventory, category_count, cate
items_to_recycle.append([])
items_to_recycle[x].append(item[0])
items_to_recycle[x].append(items_to_be_recycled)
items_to_be_recycled = items_to_be_recycled - items_to_recycle[x][1]
items_to_be_recycled = items_to_be_recycled - items_to_recycle[x][1]
x = x + 1
return items_to_recycle

Expand Down

1 comment on commit e68c2e8

@MZorzy
Copy link

@MZorzy MZorzy commented on e68c2e8 Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Altitude zero is not good

Please sign in to comment.