Skip to content

Commit

Permalink
Show passes on status page
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic-git committed Aug 7, 2011
1 parent f3de0b3 commit 8acc077
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/controller.py
Expand Up @@ -62,16 +62,25 @@ def post(self):
class ShowHunt(webapp.RequestHandler):
@utils.logged_in
def get(self, hunt_id):

def answer_letter(t,c):
if t.has_clue_left(c):
return ' '
elif t.correctly_answered(c):
return 'X'
else:
return 'P'

hunt = get_hunt_by_id(hunt_id)
if not hunt:
self.redirect('/')
return
answer_sets = []
for clue in hunt.clues:
if hunt.started:
answers = [not team.has_clue_left(clue) for team in hunt.teams]
answers = [answer_letter(team,clue) for team in hunt.teams]
else:
answers = [False for team in hunt.teams]
answers = [' ' for team in hunt.teams]
answer_sets.append({
'question': clue.question,
'answers': answers,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/hunt.html
Expand Up @@ -29,7 +29,7 @@ <h2>Hunt has started!</h2>
{% for answer_set in answer_sets %}
<tr><td>{{ answer_set.question }}</td>
{% for answer in answer_set.answers %}
<td>{% if answer %}X{% endif %}</td>
<td>{{ answer }}</td>
{% endfor %}
</tr>
{% endfor %}
Expand Down

0 comments on commit 8acc077

Please sign in to comment.