Browse Source

fix Times Caught column

testing
Burathar 5 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):
found_objectives = association_proxy('player_found_objectives', 'objective', found_objectives = association_proxy('player_found_objectives', 'objective',
creator=lambda objective: PlayerFoundObjective(objective=objective)) creator=lambda objective: PlayerFoundObjective(objective=objective))
caught_by_players = association_proxy('player_caught_by_players', 'caught_player') caught_by_players = association_proxy('player_caught_by_players', 'catching_player')
caught_players = association_proxy('player_caught_players', 'catching_player') caught_players = association_proxy('player_caught_players', 'caught_player')
def last_location(self): def last_location(self):
# pylint: disable=no-member # pylint: disable=no-member

10
app/templates/game_hunter_dashboard.html

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

Loading…
Cancel
Save