fix to challenge average score

This commit is contained in:
root 2020-10-05 17:44:07 +02:00
parent 17d64c1479
commit dd1fd1c80f
2 changed files with 6 additions and 3 deletions

View File

@ -80,7 +80,10 @@ class Challenge(models.Model):
@property
def average(self):
#this should be cached, but with low volumes its fine as is
if Game.objects.filter(challenge=self):
return int(round(Game.objects.filter(challenge=self).aggregate(Avg('score')).get('score__avg', 0)))
else:
return 0
@property
def num_rounds(self):

View File

@ -24,7 +24,7 @@ with open(os.path.join(BASE_DIR, "env_secret_key.txt")) as secret_key:
SECRET_KEY = secret_key.read().strip()
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ALLOWED_HOSTS = ['*']