fix to challenge average score
This commit is contained in:
parent
17d64c1479
commit
dd1fd1c80f
@ -80,7 +80,10 @@ class Challenge(models.Model):
|
|||||||
@property
|
@property
|
||||||
def average(self):
|
def average(self):
|
||||||
#this should be cached, but with low volumes its fine as is
|
#this should be cached, but with low volumes its fine as is
|
||||||
return int(round(Game.objects.filter(challenge=self).aggregate(Avg('score')).get('score__avg', 0)))
|
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
|
@property
|
||||||
def num_rounds(self):
|
def num_rounds(self):
|
||||||
|
@ -24,7 +24,7 @@ with open(os.path.join(BASE_DIR, "env_secret_key.txt")) as secret_key:
|
|||||||
SECRET_KEY = secret_key.read().strip()
|
SECRET_KEY = secret_key.read().strip()
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user