From 934a186987e1011c21462ab59a3ae956aa40f4ad Mon Sep 17 00:00:00 2001 From: zhiyang7 Date: Wed, 29 Dec 2021 17:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- douzero/server/orm.py | 2 +- evaluate_server.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) 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] = {