diff --git a/douzero/server/orm.py b/douzero/server/orm.py index 69bef65..7342ad3 100644 --- a/douzero/server/orm.py +++ b/douzero/server/orm.py @@ -28,7 +28,7 @@ class Battle(BaseModel): id = PrimaryKeyField() challenger_path = CharField(null = False, max_length=255, index = True) challenger_position = CharField(null = False, max_length=32) - opponent_rank = IntegerField(null = False) + opponent_rank = IntegerField(null = False, index = True) status = IntegerField(null = False, index = True) challenger_wp = DecimalField(null=True) challenger_adp = DecimalField(null=True) diff --git a/evaluate_server.py b/evaluate_server.py index 1c1cc99..2589baa 100644 --- a/evaluate_server.py +++ b/evaluate_server.py @@ -63,7 +63,6 @@ def charts(): def metrics(): type = request.args.get('type') baselines = Baseline.select().order_by(Baseline.rank.desc()).limit(3) - end_time = datetime.now() metrics = {} for i in range(len(baselines)): baseline = baselines[i] @@ -89,8 +88,7 @@ def metrics(): .select(Model.frame, Model.path, Battle.challenger_position, Battle.challenger_wp, Battle.challenger_adp) .where( Model.type == type, - Model.create_time >= baseline.create_time, - Model.create_time <= end_time + Battle.opponent_rank == baseline.rank ) .join(Battle, JOIN.INNER, on=( (Battle.challenger_path == Model.path) & @@ -98,7 +96,6 @@ def metrics(): ) .order_by(Model.create_time.asc()) ) - end_time = baseline.create_time for result in results: battle = result.battle baseline_metric[str(battle.challenger_position)][result.frame] = {