Commit 2521bd3f authored by Lukas Burgey's avatar Lukas Burgey

Fix type_list_ordered

parent 200cbcdf
......@@ -300,7 +300,7 @@ class Player(dbmodels.Model):
STAT_DESCRIPTION['best_type'] = "Best type", "BestType"
def best_type(self, it):
type_list = []
for the_type in Game.type_list_ordered():
for the_type in Game.type_list_ordered(it):
win_ratio = Game.win_ratio(
self.player0
.filter(game_type=the_type)
......@@ -630,9 +630,13 @@ class Game(dbmodels.Model):
.distinct()
# return a flat list of played game types
def type_list_ordered():
def type_list_ordered(it):
obj = Game.objects
if it:
obj = obj.filter(iteration=it)
return (
Game.objects
obj
.values_list('game_type', flat=True)
.distinct()
.order_by('base')
......@@ -772,7 +776,7 @@ def _best_player_per_type(it):
}
type_list = []
for t in Game.type_list_ordered():
for t in Game.type_list_ordered(it):
type_list.append(player_list_type(t))
return type_list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment