Changeset 21192

Show
Ignore:
Timestamp:
10/12/08 19:32:54 (5 years ago)
Author:
nishio
Message:

/lang/python/saichugen 過去のゲームの記録を10件みられるようにした

Location:
lang/python/saichugen/gae
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/python/saichugen/gae/index.yaml

    r21098 r21192  
    1010# automatically uploaded to the admin console when you next deploy 
    1111# your application using appcfg.py. 
     12 
     13# Used once in query history. 
     14- kind: Game 
     15  properties: 
     16  - name: started 
     17    direction: desc 
  • lang/python/saichugen/gae/saichugen/main/models.py

    r21191 r21192  
    44    started = db.DateTimeProperty() 
    55    info = db.BlobProperty() 
    6     memo = db.TextProperty() 
     6    title = db.StringProperty(default="") 
    77    is_finished = db.BooleanProperty(default=False) 
    88    is_started = db.BooleanProperty(default=False) 
  • lang/python/saichugen/gae/saichugen/main/views.py

    r21191 r21192  
    1414    if user: 
    1515        player = get_player_or_create(user.email()) 
     16    recent_games = Game.all().order("-started").fetch(10) 
    1617 
    1718    return HttpResponse( 
     
    2223                player=player, 
    2324                login_url=users.create_login_url(req.get_full_path()), 
    24                 logout_url=users.create_logout_url(req.get_full_path()), ))) 
     25                logout_url=users.create_logout_url(req.get_full_path()), 
     26                recent_games=recent_games, ))) 
    2527 
    2628def start_single_game(req): 
     
    4547    from datetime import datetime 
    4648    game.started = datetime.now() 
    47     addTimeLog(info, "System", "START_GAME") 
    4849    addTimeLog(info, "System", "START_ROUND", 1) 
    4950    addTimeLog(info, "System", "START_TURN", 1) 
     
    114115                msg = u"ターン%dが終了しました。<br/>" % option[0] 
    115116                msg += turnEnd(info, option[1]) 
    116  
    117117 
    118118        time_log.append(msg) 
     
    174174            if game.get_round() < 5: 
    175175                addTimeLog(info, "System", "START_ROUND", game.get_round()) 
    176         # もしラウンドIDが5ならゲーム終了処理 
     176 
    177177        if game.step == 15: 
     178            # ゲーム終了処理 
    178179            game.is_finished = True 
    179180            addTimeLog(info, "System", "END_GAME") 
  • lang/python/saichugen/gae/template/index.html

    r21191 r21192  
    1414  Welcome! You can <a href='{{ login_url }}'>login</a> to play new game. 
    1515{% endif %} 
    16          
    1716 
     17Recent games:<ul> 
     18{% for g in recent_games %} 
     19<li><a href="/game/{{ g.key.id }}/">{{ g.started|date:"Y-m-d H:i:s T" }}</a>{{ g.title }}</li> 
     20{% endfor %} 
     21</ul> 
    1822 
    1923<p>