average stars voted

This commit is contained in:
2024-08-05 23:08:31 +02:00
parent dc1853d1a7
commit 371f820c56
3 changed files with 33 additions and 1 deletions
+3 -1
View File
@@ -126,9 +126,11 @@ class SettingsView(LoginRequiredMixin, View):
def get(self, request):
backgrounds = Background.objects.all()
(profile,created) = Profile.objects.get_or_create(user=request.user)
average_vote = Vote.objects.filter(user=request.user).aggregate(Avg("points", default=0))['points__avg']
context = {
"backgrounds": backgrounds,
"currentBackground": (profile.background.id if profile.background else 1)
"currentBackground": (profile.background.id if profile.background else 1),
"average": average_vote
}
spt_token = profile.get_or_update_spt()
if spt_token: