Skip to content

Commit

Permalink
Fix 'is_in_battle' status from gyms and add it to webhook requests (#…
Browse files Browse the repository at this point in the history
…1217)

* fixed is_in_battle column value into gym table

* added is_in_battle value to be sent to webhooks
  • Loading branch information
Lecnets authored Dec 14, 2021
1 parent 53d8eb0 commit 80be05c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mapadroid/db/DbPogoProtoSubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def gyms(self, origin: str, map_proto: dict):
"guard_pokemon_id=VALUES(guard_pokemon_id), team_id=VALUES(team_id), "
"slots_available=VALUES(slots_available), last_scanned=VALUES(last_scanned), "
"last_modified=VALUES(last_modified), latitude=VALUES(latitude), longitude=VALUES(longitude), "
"is_ex_raid_eligible=VALUES(is_ex_raid_eligible), is_ar_scan_eligible=VALUES(is_ar_scan_eligible)"
"is_ex_raid_eligible=VALUES(is_ex_raid_eligible), is_ar_scan_eligible=VALUES(is_ar_scan_eligible), is_in_battle=VALUES(is_in_battle)"
)
query_gym_details = (
"INSERT INTO gymdetails (gym_id, name, url, last_scanned) "
Expand All @@ -777,6 +777,7 @@ def gyms(self, origin: str, map_proto: dict):
last_modified_ts).strftime("%Y-%m-%d %H:%M:%S")
is_ex_raid_eligible = gym["gym_details"]["is_ex_raid_eligible"]
is_ar_scan_eligible = gym["is_ar_scan_eligible"]
is_in_battle = gym['gym_details']['is_in_battle']

cache_key = "gym{}{}".format(gymid, last_modified_ts)
if cache.exists(cache_key):
Expand All @@ -788,7 +789,7 @@ def gyms(self, origin: str, map_proto: dict):
1, # enabled
latitude, longitude,
0, # total CP
0, # is_in_battle
is_in_battle,
last_modified, # last_modified
now, # last_scanned
is_ex_raid_eligible,
Expand Down
3 changes: 2 additions & 1 deletion mapadroid/webhook/webhookworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ def __prepare_gyms_data(self, gym_data):
"team_id": gym["team_id"],
"name": gym["name"],
"slots_available": gym["slots_available"],
"is_ar_scan_eligible": gym["is_ar_scan_eligible"]
"is_ar_scan_eligible": gym["is_ar_scan_eligible"],
"is_in_battle": gym["is_in_battle"]
}

if gym.get("description", None) is not None:
Expand Down

0 comments on commit 80be05c

Please sign in to comment.