Bewertungen verstecken wenn keine vorhanden und Möglichkeit zum deaktivieren von Bewertungen

This commit is contained in:
Juhn-Vitus Saß
2025-04-22 18:28:50 +02:00
parent a16c97c4f3
commit 154110e510
6 changed files with 27 additions and 6 deletions

View File

@@ -4,10 +4,8 @@ from channels.generic.websocket import AsyncWebsocketConsumer
from channels.db import database_sync_to_async
from django.utils import timezone
from django.urls import reverse
from django.db import models
from datetime import timedelta
from play.models import QuizGame, QuizGameParticipant, QuizAnswer
from django.conf import settings
class GameConsumer(AsyncWebsocketConsumer):
@@ -244,6 +242,8 @@ class GameConsumer(AsyncWebsocketConsumer):
@database_sync_to_async
def save_rating(self, participant_id, rating):
if not settings.QIVIP_CONFIG['ENABLE_RATING_SYSTEM']:
return False
from library.models import QuizRating
try:
game = QuizGame.objects.get(join_code=self.join_code)