From 818008fc746c47228c9c8c053c4478c8792db30f Mon Sep 17 00:00:00 2001 From: ZaneYork Date: Thu, 12 Sep 2024 10:33:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=BD=E7=AD=BE=E7=AE=97?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E9=99=8D=E4=BD=8E=E9=9A=8F=E6=9C=BA=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao.py | 2 -- src/dinner.py | 4 +++- templates/dinner.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dao.py b/src/dao.py index e6780f7..8d3784b 100644 --- a/src/dao.py +++ b/src/dao.py @@ -178,8 +178,6 @@ def fetch_roll_result_list(interval: int = 0, limit: int = 3) -> Generator[str, row = cursor.fetchone() while row is not None: yield row[0] - if interval != 0: - return row = cursor.fetchone() finally: cursor.close() diff --git a/src/dinner.py b/src/dinner.py index 077001a..b81ce4f 100644 --- a/src/dinner.py +++ b/src/dinner.py @@ -74,7 +74,7 @@ def vote_reduce(summary: dict[str, float], limit: int = 2) -> tuple[dict[str, fl # 昨日中签项降低权重 for i, last_result in enumerate(last_results): if last_result in summary: - summary[last_result] = summary[last_result] * (9 - i) / 10 + summary[last_result] = summary[last_result] * (8 - i) / 10 total_vote = sum(value for value in summary.values()) return summary, total_vote, last_results @@ -163,6 +163,8 @@ def dinner(): summary_keys = list(filter(lambda x: x in summary.keys(), map(lambda y: y['name'], all_choice))) if not result: predict_result = roll_logic(check=True) + else: + predict_result = None return render_template('dinner.html', all_choice=all_choice, menu=menu, diff --git a/templates/dinner.html b/templates/dinner.html index 2ebe423..6d92733 100644 --- a/templates/dinner.html +++ b/templates/dinner.html @@ -9,7 +9,7 @@

每天8:00-17:30间开放匿名投票更新,17:30以后允许发起抽签,抽签结果确定后不可更改

第一名与第二名得票数相差不超过10%时随机抽签,按其得票数决定中签概率,否则选择第一名

{% for last_result in last_results %} -

今日{{ last_result }}最终得票数降低{{ 1 + loop.index0 }}0%

+

今日{{ last_result }}最终得票数降低{{ 2 + loop.index0 }}0%

{% endfor %}