@ -9,81 +9,91 @@
{% block player_app_content %}
{% block player_app_content %}
< div class = "row" >
< div class = "row" >
< div class = "col-xs-0 col-md-1" > < / div >
< div class = "col-xs-0 col-md-1" > < / div >
< div class = "col-xs-12 col-md-7" >
< div class = "col-xs-12 col-md-7" >
< h2 > Bunnies< / h2 >
< h2 > Bunnies< / h2 >
< div class = "table" >
< div class = "table" >
< table class = "table" >
< table class = "table" >
< thead >
< thead >
< tr >
< tr >
< th scope = "col" > Player Name< / th >
< th scope = "col" > Player Name< / th >
< th scope = "col" > Times Caught< / th >
< th scope = "col" > Times Caught< / th >
< th scope = "col" > Last location< / th >
< th scope = "col" > Last location< / th >
< th scope = "col" > < / th >
< th scope = "col" > < / th >
< / tr >
< / tr >
< / thead >
< / thead >
< tbody >
< tbody >
{% set player = current_user.player_in(game) %}
{% set player = current_user.player_in(game) %}
{% for bunny in game.bunnies() %}
{% for bunny in game.bunnies() %}
< tr >
< tr >
< td > {{ bunny.user.name }}< / td >
< td > {{ bunny.user.name }}< / td >
< td > < span style = "color:green;" > {{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'accepted') |list|length}}< / span > /
< td > < span
< span style = "color:red;" > {{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'denied') |list|length}}< / span > /
style="color:green;">{{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'accepted') |list|length}}< / span >
< span style = "color:gray;" > {{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'none') |list|length}}< / span >
/
< / td >
< span
< td > {% with location = bunny.last_location(offset=hunter_delay) %}
style="color:red;">{{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'denied') |list|length}}< / span >
{% if location %}{{ moment(location.timestamp).fromNow()}}
/
{% else %}
< span
{{ location }}
style="color:gray;">{{ bunny.player_caught_by_players | selectattr('catching_player', '==', player) | selectattr('review.name', '==', 'none') |list|length}}< / span >
{% endif %}
< / td >
{% endwith %}< / td >
< td > {% with location = bunny.last_location(offset=hunter_delay) %}
< td >
{% if location %}{{ moment(location.timestamp).fromNow()}}
< a href = "{{ url_for('main.catch_bunny', game_name=game.name, bunny_name=bunny.user.name) }}" >
{% else %}
< button class = "btn btn-success btn-sm" > Catch< / button >
{{ location }}
< / a >
{% endif %}
< / td >
{% endwith %}< / td >
< / tr >
< td >
{% endfor %}
< a
< / tbody >
href="{{ url_for('main.catch_bunny', game_name=game.name, bunny_name=bunny.user.name) }}">
< / table >
< button class = "btn btn-success btn-sm" > Catch< / button >
< span style = "font-size: smaller;" >
< / a >
(< span style = "color:green;" > Accepted< / span > /< span style = "color:red;" > Denied< / span > /< span style = "color:gray;" > Not reviewed< / span > )
< / td >
< / span >
< / tr >
{% endfor %}
< / tbody >
< / table >
< span style = "font-size: smaller;" >
(< span style = "color:green;" > Accepted< / span > /< span style = "color:red;" > Denied< / span > /< span
style="color:gray;">Not
reviewed< / span > )
< / span >
< / div >
< / div >
< div class = "col-xs-12 col-md-3" >
{% include '_game_player_info.html' %}
< / div >
< / div >
< / div >
< div class = "col-xs-12 col-md-3" >
{% include '_game_player_info.html' %}
< / div >
< / div >
< / div >
< div class = "row" >
< div class = "row" >
< div class = "col-xs-1 col-md-1" > < / div >
< div class = "col-xs-1 col-md-1" > < / div >
< div id = "map" style = " height: 500px; border-radius: 10px; " class = "col-xs-10 col-md-10" > < / div >
< div id = "map" style = " height: 500px; border-radius: 10px; " class = "col-xs-10 col-md-10" > < / div >
< div class = "col-xs-1 col-md-1" > < / div >
< div class = "col-xs-1 col-md-1" > < / div >
< / div >
< / div >
{% endblock %}
{% endblock %}
{% block scripts %}
{% block scripts %}
{{ super() }}
{{ super() }}
< script type = "text/javascript" , crossorigin = "anonymous" >
< script type = "text/javascript" , crossorigin = "anonymous" >
// Leaflet Map
// Leaflet Map
map = getMap()
map = getMap()
markers = []
var bunnies = JSON.parse('{{ json.dumps(game.last_locations(game.bunnies(), offset=hunter_delay), cls=location_encoder)|safe }}')
var bunnies = JSON.parse(
for (var i = 0; i < bunnies.length ; i + + ) {
'{{ json.dumps(game.last_locations(game.bunnies(), offset=hunter_delay), cls=location_encoder)|safe }}')
for (var i = 0; i < bunnies.length ; i + + ) {
addPlayerMarker(map, bunnies[i])
addPlayerMarker(map, bunnies[i])
markers.push([bunnies[i].latitude, bunnies[i].longitude])
}
}
var self = JSON.parse('{{ json.dumps(current_user.last_location(game ), cls=location_encoder)|safe }}')
var self = JSON.parse('{{ json.dumps(current_user.last_location(), cls=location_encoder)|safe }}')
if (self){
if (self) {
addPlayerMarker(map, self, greenPlayerIcon)
addPlayerMarker(map, self, greenPlayerIcon)
markers.push([self.latitude, self.longitude])
}
if (markers.length > 0) {
map.fitBounds(markers);
}
}
map.fitBounds(
bunnies.map(o => [o.latitude, o.longitude]).concat([self].map(p => [p.latitude, p.longitude]))
);
< / script >
< / script >
{% endblock %}
{% endblock %}