예제 #1
0
파일: views.py 프로젝트: MMX13/tipping
    def get_queryset(self):
        round = self.request.query_params.get('round', None)
        if round is None:
            round = get_current_round()

        round_object = Round.objects.get(round=round)
        return Game.objects.filter(round=round_object)
예제 #2
0
파일: views.py 프로젝트: DenverJ/tipping
 def get_queryset(self):
     scores = RoundScore.objects.all()
     scores = [
         score for score in scores
         if score.round.round <= get_current_round()
     ]
     return scores
예제 #3
0
파일: views.py 프로젝트: DenverJ/tipping
    def get_queryset(self):
        round = self.request.query_params.get('round', None)
        if round is None:
            round = get_current_round()

        round_object = Round.objects.get(round=round)
        return Game.objects.filter(round=round_object)
예제 #4
0
파일: views.py 프로젝트: MMX13/tipping
    def get_queryset(self):

        round = self.request.query_params.get('round', None)
        user = self.request.user

        current_round = get_current_round()
        if round is None:
            round = current_round
        else:
            round = int(round)

        # Get the tips for the round
        tips = Tip.objects.filter(user=user, round=round)

        # If its a future round, or an invalid round, return nothing
        if round>current_round or round<1:
            return tips

        # If it's the current round, and the user hasn't tipped yet, populate with defaults
        elif round==current_round and not tips:
            default_tips(round, user)
            tips = Tip.objects.filter(user=user, round=round)

        return tips
예제 #5
0
파일: views.py 프로젝트: DenverJ/tipping
    def get_queryset(self):

        round = self.request.query_params.get('round', None)
        user = self.request.user

        current_round = get_current_round()
        if round is None:
            round = current_round
        else:
            round = int(round)

        # Get the tips for the round
        tips = Tip.objects.filter(user=user, round=round)

        # If its a future round, or an invalid round, return nothing
        if round > current_round or round < 1:
            return tips

        # If it's the current round, and the user hasn't tipped yet, populate with defaults
        elif round == current_round and not tips:
            default_tips(round, user)
            tips = Tip.objects.filter(user=user, round=round)

        return tips
예제 #6
0
파일: views.py 프로젝트: MMX13/tipping
def CurrentRoundView(request):
    return JsonResponse({'round': get_current_round()})
예제 #7
0
파일: views.py 프로젝트: MMX13/tipping
 def get_queryset(self):
     scores = RoundScore.objects.all()
     scores = [score for score in scores if score.round.round<=get_current_round()]
     return scores
예제 #8
0
파일: views.py 프로젝트: DenverJ/tipping
def CurrentRoundView(request):
    return JsonResponse({'round': get_current_round()})