def grandchalls_results(request): return render_to_response( 'grandchallenge/cpanel/grandchallenge_results.html', { 'gchalls': GrandChallenge.get_challenges(), 'clasament': GrandChallenge.clasament() }, context_instance=RequestContext(request))
def grandchalls_round(request): """ Play a round """ # TODO: move logic to models. """ regular round """ over = 0 done = GrandChallenge.all_done() if not GrandChallengeGame.is_final(): if done: GrandChallenge.joaca(GrandChallengeGame.round_number) if GrandChallengeGame.round_number % 2 == 0: GrandChallenge.play_round(1) GrandChallenge.play_round(0) else: GrandChallenge.play_round(1) GrandChallengeGame.round_number += 1 else: """ final 2 players they may have to play 2 rounds if the winners finalist lose to the loosers finalist """ if GrandChallengeGame.round_number != 10: GrandChallengeGame.final_round() GrandChallenge.joaca(GrandChallengeGame.round_number) GrandChallenge.play_round(1) GrandChallenge.play_round(0) if GrandChallengeGame.is_winner(): over = 1 else: if not GrandChallengeGame.is_winner(): GrandChallengeGame.final_second_round() over = 1 GrandChallengeGame.round_number += 1 gchalls = sorted(GrandChallenge.get_challenges(), key=lambda gc:gc.branch) return render_to_response('grandchallenge/cpanel/grandchallenge.html', {'gchalls': gchalls, 'nr': GrandChallengeGame.round_number, 'done': done, 'over': over}, context_instance=RequestContext(request))
def grandchalls_results(request): return render_to_response('grandchallenge/cpanel/grandchallenge_results.html', {'gchalls': GrandChallenge.get_challenges(), 'clasament': GrandChallenge.clasament()}, context_instance=RequestContext(request))
def grandchalls_round(request): """ Play a round """ # TODO: move logic to models. """ regular round """ over = 0 done = GrandChallenge.all_done() if not GrandChallengeGame.is_final(): if done: GrandChallenge.joaca(GrandChallengeGame.round_number) if GrandChallengeGame.round_number % 2 == 0: GrandChallenge.play_round(1) GrandChallenge.play_round(0) else: GrandChallenge.play_round(1) GrandChallengeGame.round_number += 1 else: """ final 2 players they may have to play 2 rounds if the winners finalist lose to the loosers finalist """ if GrandChallengeGame.round_number != 10: GrandChallengeGame.final_round() GrandChallenge.joaca(GrandChallengeGame.round_number) GrandChallenge.play_round(1) GrandChallenge.play_round(0) if GrandChallengeGame.is_winner(): over = 1 else: if not GrandChallengeGame.is_winner(): GrandChallengeGame.final_second_round() over = 1 GrandChallengeGame.round_number += 1 gchalls = sorted(GrandChallenge.get_challenges(), key=lambda gc: gc.branch) return render_to_response( 'grandchallenge/cpanel/grandchallenge.html', {'gchalls': gchalls, 'nr': GrandChallengeGame.round_number, 'done': done, 'over': over}, context_instance=RequestContext(request))