Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'is_in_battle' db field and icon on map #2500

Open
wants to merge 52 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ca6c877
Remove no longer required images
michikrug Feb 15, 2018
9c526d1
Introduce dynamic gym image creation
michikrug Feb 15, 2018
c245f97
Update .gitignore
michikrug Feb 15, 2018
895fae7
Add single egg images
michikrug Feb 15, 2018
ea75a49
Fix lint errors
michikrug Feb 15, 2018
da8ae78
Fix sprite url
michikrug Feb 15, 2018
e8f5ffd
Use some shadow
michikrug Feb 15, 2018
c4a99b7
Store current gym values before image creation to avoid timing issues…
michikrug Feb 16, 2018
c00f92d
Fix typos
michikrug Feb 16, 2018
d74cbdb
Fix broken gym/raid filter
michikrug Feb 19, 2018
5c653f4
Fix error
michikrug Feb 19, 2018
717172e
Handle exceeded localstorage quota
michikrug Feb 22, 2018
ff6ae86
Make Store gets faster, which was a major performance issue
michikrug Feb 22, 2018
5b58511
Fix minor issue and lint error
michikrug Feb 23, 2018
20b514a
Add is_in_battle db field and icon on gym image
michikrug Feb 23, 2018
0e939e7
Merge remote-tracking branch 'own2/PR-create-gym-images' into PR-is-i…
michikrug Mar 1, 2018
7004baf
Remove no longer required images
michikrug Feb 15, 2018
d91f728
Introduce dynamic gym image creation
michikrug Feb 15, 2018
22347f8
Update .gitignore
michikrug Feb 15, 2018
e5ed713
Add single egg images
michikrug Feb 15, 2018
c771c15
Fix lint errors
michikrug Feb 15, 2018
2b18a20
Fix sprite url
michikrug Feb 15, 2018
66963ec
Use some shadow
michikrug Feb 15, 2018
352df09
Store current gym values before image creation to avoid timing issues…
michikrug Feb 16, 2018
b179dfd
Fix typos
michikrug Feb 16, 2018
b2f8848
Fix broken gym/raid filter
michikrug Feb 19, 2018
1984754
Fix error
michikrug Feb 19, 2018
820222f
Handle exceeded localstorage quota
michikrug Feb 22, 2018
6ae51d0
Make Store gets faster, which was a major performance issue
michikrug Feb 22, 2018
2cc63a4
Fix minor issue and lint error
michikrug Feb 23, 2018
260cda2
Add park support and 'EX' mark on image
michikrug Mar 1, 2018
8422d69
Merge branch 'PR-create-gym-images' into PR-is-in-battle
michikrug Mar 1, 2018
97768e4
Remove no longer required images
michikrug Feb 15, 2018
e5bd3c9
Introduce dynamic gym image creation
michikrug Feb 15, 2018
d8cd545
Update .gitignore
michikrug Feb 15, 2018
d244a49
Add single egg images
michikrug Feb 15, 2018
e425140
Fix lint errors
michikrug Feb 15, 2018
430f182
Fix sprite url
michikrug Feb 15, 2018
e8e2649
Use some shadow
michikrug Feb 15, 2018
06dc0b8
Store current gym values before image creation to avoid timing issues…
michikrug Feb 16, 2018
d6f2cb9
Fix typos
michikrug Feb 16, 2018
7d37324
Fix broken gym/raid filter
michikrug Feb 19, 2018
a883182
Fix error
michikrug Feb 19, 2018
f82ee65
Handle exceeded localstorage quota
michikrug Feb 22, 2018
f685bc7
Make Store gets faster, which was a major performance issue
michikrug Feb 22, 2018
aae5442
Fix minor issue and lint error
michikrug Feb 23, 2018
5591846
Add park support and 'EX' mark on image
michikrug Mar 1, 2018
d9b30f8
Update static01.zip
michikrug Mar 12, 2018
2d0a980
Merge remote-tracking branch 'own2/PR-create-gym-images' into PR-is-i…
michikrug Mar 12, 2018
be586dd
Add 'is_in_battle' db field, Add ⚔ label to gym marker
michikrug Mar 13, 2018
440f9e9
Change position of battle mark
michikrug Mar 13, 2018
f6225cc
Minor change
michikrug Mar 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions pogom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
flaskDb = FlaskDB()
cache = TTLCache(maxsize=100, ttl=60 * 5)

db_schema_version = 28
db_schema_version = 29


class MyRetryDB(RetryOperationalError, PooledMySQLDatabase):
Expand Down Expand Up @@ -437,6 +437,7 @@ class Gym(LatLongModel):
total_cp = SmallIntegerField()
last_modified = DateTimeField(index=True)
last_scanned = DateTimeField(default=datetime.utcnow, index=True)
is_in_battle = BooleanField(default=False)

class Meta:
indexes = ((('latitude', 'longitude'), False),)
Expand Down Expand Up @@ -565,7 +566,8 @@ def get_gym(id):
Gym.longitude,
Gym.last_modified,
Gym.last_scanned,
Gym.total_cp)
Gym.total_cp,
Gym.is_in_battle)
.join(GymDetails, JOIN.LEFT_OUTER,
on=(Gym.gym_id == GymDetails.gym_id))
.where(Gym.gym_id == id)
Expand Down Expand Up @@ -2207,7 +2209,9 @@ def parse_map(args, map_dict, scan_coords, scan_location, db_update_queue,
'last_modified':
f.last_modified_timestamp_ms,
'raid_active_until':
raid_active_until
raid_active_until,
'is_in_battle':
f.is_in_battle
}))
gyms[f.id] = {
'gym_id':
Expand All @@ -2231,7 +2235,8 @@ def parse_map(args, map_dict, scan_coords, scan_location, db_update_queue,
'last_modified':
datetime.utcfromtimestamp(
f.last_modified_timestamp_ms / 1000.0),

'is_in_battle':
f.is_in_battle
}

if not args.no_raids and f.type == 0:
Expand Down Expand Up @@ -3549,6 +3554,13 @@ def database_migrate(db, old_ver):
SmallIntegerField(null=True))
)

if old_ver < 29:
migrate(
# Add `is_in_battle` column to `gym`
migrator.add_column('gym', 'is_in_battle',
BooleanField(null=False, default=False))
)

# Always log that we're done.
log.info('Schema upgrade complete.')
return True
14 changes: 11 additions & 3 deletions static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1217,21 +1217,29 @@ function updateGymMarker(item, marker) {
}
marker.setIcon({
url: markerImage,
scaledSize: new google.maps.Size(48, 48)
scaledSize: new google.maps.Size(48, 48),
labelOrigin: new google.maps.Point(15, 12)
})
marker.setZIndex(google.maps.Marker.MAX_ZINDEX + 1)
} else if (hasActiveRaid && raidLevelVisible && showRaidSetting) {
marker.setIcon({
url: 'static/images/gym/' + gymTypes[item.team_id] + '_' + getGymLevel(item) + '_' + item['raid']['level'] + '.png',
scaledSize: new google.maps.Size(48, 48)
scaledSize: new google.maps.Size(48, 48),
labelOrigin: new google.maps.Point(15, 12)
})
} else {
marker.setIcon({
url: 'static/images/gym/' + gymTypes[item.team_id] + '_' + getGymLevel(item) + '.png',
scaledSize: new google.maps.Size(48, 48)
scaledSize: new google.maps.Size(48, 48),
labelOrigin: new google.maps.Point(15, 12)
})
marker.setZIndex(1)
}
if (item.is_in_battle) {
marker.setLabel({ text: '⚔', fontSize: '16px' })
} else {
marker.setLabel(null)
}
marker.infoWindow.setContent(gymLabel(item))
return marker
}
Expand Down