Browse Source

fix Times Caught column

testing
Burathar 4 years ago
parent
commit
bdc61af997
  1. 4
      app/models/game_player.py
  2. 10
      app/templates/game_hunter_dashboard.html

4
app/models/game_player.py

@ -31,8 +31,8 @@ class GamePlayer(db.Model): @@ -31,8 +31,8 @@ class GamePlayer(db.Model):
found_objectives = association_proxy('player_found_objectives', 'objective',
creator=lambda objective: PlayerFoundObjective(objective=objective))
caught_by_players = association_proxy('player_caught_by_players', 'caught_player')
caught_players = association_proxy('player_caught_players', 'catching_player')
caught_by_players = association_proxy('player_caught_by_players', 'catching_player')
caught_players = association_proxy('player_caught_players', 'caught_player')
def last_location(self):
# pylint: disable=no-member

10
app/templates/game_hunter_dashboard.html

@ -24,16 +24,16 @@ @@ -24,16 +24,16 @@
</tr>
</thead>
<tbody>
{% for player in game.bunnies() %}
{% for bunny in game.bunnies() %}
<tr>
<td>{{ player.user.name }}</td>
<td>{{ player.caught_by_players | selectattr('catching_player', '==', current_user.player_in(game)) |list|length}}</td>
<td>{% with location = player.user.last_location(game) %}
<td>{{ bunny.user.name }}</td>
<td>{{ bunny.player_caught_by_players | selectattr('catching_player', '==', current_user.player_in(game)) |list|length}}</td>
<td>{% with location = bunny.user.last_location(game) %}
{% if location %}{{ moment(location.timestamp).fromNow()}}: {% endif %}
{{ location }}
{% endwith %}</td>
<td>
<a href="{{ url_for('main.catch_bunny', game_name=game.name, bunny_name=player.name) }}">
<a href="{{ url_for('main.catch_bunny', game_name=game.name, bunny_name=bunny.name) }}">
<button class="btn btn-success">Catch</button>
</a>
</td>

Loading…
Cancel
Save