Esempio n. 1
0
def index(request):
    """ Shows all rounds played by the current user """
    profile = request.user.get_profile()
    gc_user = profile.get_extension(GrandChallengeUser)

    active = gc_user.get_active()
    played = gc_user.get_played()

    if not gc_user in GrandChallengeGame.base_query():
        return do_result(request, error='Ne pare rau, nu participi in turneu ')

    return render_to_response('grandchallenge/index.html',
            {'active': active, 'played': played, 'gcuser': gc_user, 'gc': GrandChallengeGame},
            context_instance=RequestContext(request))
Esempio n. 2
0
def index(request):
    """ Shows all rounds played by the current user """
    profile = request.user.get_profile()
    gc_user = profile.get_extension(GrandChallengeUser)

    active = gc_user.get_active()
    played = gc_user.get_played()

    if not gc_user in GrandChallengeGame.base_query():
        messages.error(request, _('We are sorry, you are not part of the tournament'))
        return render(request, 'grandchallenge/message.html')

    return render_to_response('grandchallenge/index.html',
            {'active': active, 'played': played, 'gcuser': gc_user, 'gc': GrandChallengeGame},
            context_instance=RequestContext(request))
Esempio n. 3
0
    def _simulate_n_users(self, n):
        """
        Create n users and simulate a GC run.
        """
        for i in range(n):
            self._get_player(i)

        GrandChallengeGame.start()
        self.assertEqual(GrandChallengeGame.get_current_round().round_number, 1)
        self.assertEqual(GrandChallengeGame.base_query().count(), n)
        self.assertEqual(len(GrandChallengeGame.get_current_round().participants()), n - n % 2)
        while not GrandChallengeGame.is_finished():
            GrandChallengeGame.round_next()
        GrandChallengeGame.force_round_close(GrandChallengeGame.get_current_round())
        GrandChallengeGame.round_next()
        GrandChallengeGame.force_round_close(GrandChallengeGame.get_current_round())
Esempio n. 4
0
def index(request):
    """ Shows all rounds played by the current user """
    profile = request.user.get_profile()
    gc_user = profile.get_extension(GrandChallengeUser)

    active = gc_user.get_active()
    played = gc_user.get_played()

    if not gc_user in GrandChallengeGame.base_query():
        return do_result(request, error='Ne pare rau, nu participi in turneu ')

    return render_to_response('grandchallenge/index.html', {
        'active': active,
        'played': played,
        'gcuser': gc_user,
        'gc': GrandChallengeGame
    },
                              context_instance=RequestContext(request))
Esempio n. 5
0
def index(request):
    """ Shows all rounds played by the current user """
    profile = request.user.get_profile()
    gc_user = profile.get_extension(GrandChallengeUser)

    active = gc_user.get_active()
    played = gc_user.get_played()

    if not gc_user in GrandChallengeGame.base_query():
        messages.error(request,
                       _('We are sorry, you are not part of the tournament'))
        return render(request, 'grandchallenge/message.html')

    return render_to_response('grandchallenge/index.html', {
        'active': active,
        'played': played,
        'gcuser': gc_user,
        'gc': GrandChallengeGame
    },
                              context_instance=RequestContext(request))
Esempio n. 6
0
    def _simulate_n_users(self, n):
        """
        Create n users and simulate a GC run.
        """
        for i in range(n):
            self._get_player(i)

        GrandChallengeGame.start()
        self.assertEqual(GrandChallengeGame.get_current_round().round_number,
                         1)
        self.assertEqual(GrandChallengeGame.base_query().count(), n)
        self.assertEqual(
            len(GrandChallengeGame.get_current_round().participants()),
            n - n % 2)
        while not GrandChallengeGame.is_finished():
            GrandChallengeGame.round_next()
        GrandChallengeGame.force_round_close(
            GrandChallengeGame.get_current_round())
        GrandChallengeGame.round_next()
        GrandChallengeGame.force_round_close(
            GrandChallengeGame.get_current_round())