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


Python Score.get_bet_score方法代码示例

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


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

示例1: player_detailed

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_bet_score [as 别名]
def player_detailed(request, user_id):

    user = User.objects.get(id=user_id)
    score = Score(user)

    group_bets = []
    round_16_bets = []
    quarter_bets = []
    semi_bets = []
    third_place = None
    final = None

    player = user.player

    if Bet.query_all_bets(player).exists():
        group_bets = Bet.query_all_bets(player).filter(game__stage=Game.GROUP).order_by('game__id')
        round_16_bets = Bet.query_all_bets(player).filter(game__stage=Game.ROUND_OF_16).order_by(
            'game__id')
        quarter_bets = Bet.query_all_bets(player).filter(game__stage=Game.QUARTER_FINALS).order_by(
            'game__id')
        semi_bets = Bet.query_all_bets(player).filter(game__stage=Game.SEMI_FINALS).order_by(
            'game__id')

        third_place = Bet.get_by_match_id(player, 63)
        final = Bet.get_by_match_id(player, 64)

        # Adicionando estes atributo a cada bet para facilitar template
        for bet in group_bets:
            bet.player_score = score.get_bet_score(bet.game_id)
        for bet in round_16_bets:
            bet.player_score = score.get_bet_score(bet.game_id)
        for bet in quarter_bets:
            bet.player_score = score.get_bet_score(bet.game_id)
        for bet in semi_bets:
            bet.player_score = score.get_bet_score(bet.game_id)
        third_place.player_score = score.get_bet_score(third_place.game_id)
        final.player_score = score.get_bet_score(final.game_id)

    users = User.objects.filter(player__bet_room=request.user.player.bet_room).exclude(id=request.user.id)
    current_user_name = '%s %s' % (user.first_name, user.last_name) if user in users else 'Você'

    first_round_score = score.first_round_first_half_score + score.first_round_second_half_score
    second_round_score = score.round_of_16_qualified_score + score.get_round_of_16_results_score() + \
                         score.quarter_finals_qualified_score + score.get_quarter_finals_result_score() + \
                         score.finals_qualified_score + score.get_finals_result_score()

    return render_to_response('player.html',
                              {'current_user_name': current_user_name,
                               'users': users,
                               'score': score,
                               'first_round_score': first_round_score,
                               'second_round_score': second_round_score,
                               'bet_room': player.bet_room,
                               'group_bets': group_bets,
                               'round_16_bets': round_16_bets,
                               'quarter_bets': quarter_bets,
                               'semi_bets': semi_bets,
                               'third_place': third_place,
                               'final': final,
                               'total_score': score.total_score,
                               'podium_scores': score.podium_scores},
                              RequestContext(request))
开发者ID:fcaneto,项目名称:wc-betting-app,代码行数:64,代码来源:views.py


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