Skip to content

Commit

Permalink
Add DB execution context for gym_park. (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
friscoMad authored and sebastienvercammen committed Mar 3, 2018
1 parent 15be085 commit ef6fd17
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pogom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,11 @@ def set_gyms_in_park(gyms, park):

@staticmethod
def get_gyms_park(id):
gym_by_id = Gym.select(Gym.park).where(
Gym.gym_id == id).dicts()
if gym_by_id:
return gym_by_id[0]['park']
with Gym.database().execution_context():
gym_by_id = Gym.select(Gym.park).where(
Gym.gym_id == id).dicts()
if gym_by_id:
return gym_by_id[0]['park']
return False


Expand Down

0 comments on commit ef6fd17

Please sign in to comment.