当前位置: 首页>>代码示例>>Python>>正文


Python PersistenceManager.get_luck_score方法代码示例

本文整理汇总了Python中persistence.PersistenceManager.get_luck_score方法的典型用法代码示例。如果您正苦于以下问题:Python PersistenceManager.get_luck_score方法的具体用法?Python PersistenceManager.get_luck_score怎么用?Python PersistenceManager.get_luck_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在persistence.PersistenceManager的用法示例。


在下文中一共展示了PersistenceManager.get_luck_score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: game

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import get_luck_score [as 别名]
def game():
    id = str(request.args.get('id'))
    pm = PersistenceManager(myapp.db_connector)
    game = pm.get_game(session,id)
    if game == None:
        return redirect(url_for('new'))

    player1 = game.game_players[0]
    player2 = game.game_players[1]

    winning_player = "Unknown"
    if game.game_winner is not None:
        winning_player = game.game_winner.name

    #summary_stats = GameSummaryStats(game)
    game_tape = GameTape(game)
    game_tape.score()

    luck_result = pm.get_luck_score(session, game.id)

    if luck_result is None:

        luck_result = calculate_luck_result(game, game_tape=game_tape)
        if luck_result is not None:
            myapp.db_connector.get_session().add(luck_result)
            myapp.db_connector.get_session().commit()

    return render_template( 'game_summary.html',
                            game=game,
                            player1=player1,
                            player2=player2,
                            winner=winning_player,
                            game_tape=game_tape,
                            colorscale=colorscale() )
开发者ID:lhayhurst,项目名称:ladyluck,代码行数:36,代码来源:ladyluck.py


注:本文中的persistence.PersistenceManager.get_luck_score方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。