Skip to content

Commit

Permalink
fix formatting and TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
olewoy committed May 15, 2023
1 parent e2f9c55 commit b33e649
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions evap/rewards/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from django.contrib import messages
from django.core.exceptions import BadRequest, SuspiciousOperation
from django.db.models import Sum
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import get_language
from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST
from django.db.models import Sum

from evap.evaluation.auth import manager_required, reward_user_required
from evap.evaluation.models import Semester
Expand Down Expand Up @@ -92,10 +92,14 @@ def index(request):
def reward_point_redemption_events(request):
upcoming_events = RewardPointRedemptionEvent.objects.filter(redeem_end_date__gte=datetime.now()).order_by("date")
past_events = RewardPointRedemptionEvent.objects.filter(redeem_end_date__lt=datetime.now()).order_by("-date")
total_points_granted = RewardPointGranting.objects.aggregate(Sum("value"))["value__sum"]
total_points_redeemed = RewardPointRedemption.objects.aggregate(Sum("value"))["value__sum"]
total_points_granted = RewardPointGranting.objects.aggregate(Sum("value"))["value__sum"] or 0
total_points_redeemed = RewardPointRedemption.objects.aggregate(Sum("value"))["value__sum"] or 0
total_points_available = total_points_granted - total_points_redeemed
template_data = {"upcoming_events": upcoming_events, "past_events": past_events, "total_points_available": total_points_available}
template_data = {
"upcoming_events": upcoming_events,
"past_events": past_events,
"total_points_available": total_points_available,
}
return render(request, "rewards_reward_point_redemption_events.html", template_data)


Expand Down

0 comments on commit b33e649

Please sign in to comment.