diff --git a/geogame/main/models.py b/geogame/main/models.py index 7d10d78..7f953ea 100644 --- a/geogame/main/models.py +++ b/geogame/main/models.py @@ -80,7 +80,10 @@ class Challenge(models.Model): @property def average(self): #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 def num_rounds(self): @@ -148,4 +151,4 @@ class GameRound(models.Model): self.result = 0 else: self.result = int(round(14.46 * (11.52 - math.log(dst)))) - super().save(*args, **kwargs) \ No newline at end of file + super().save(*args, **kwargs) diff --git a/geogame/settings.py b/geogame/settings.py index 00193d0..b433889 100644 --- a/geogame/settings.py +++ b/geogame/settings.py @@ -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 = ['*']