From 4c7cd00a764256883956d84e68874c20e39dbf9e Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Wed, 15 May 2024 08:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20histories?= =?UTF-8?q?=20=E5=8F=AA=E6=9C=89=E4=B8=80=E6=9D=A1=E6=97=B6=E6=8E=A8?= =?UTF-8?q?=E7=AE=97=E6=95=B0=E6=8D=AE=E5=87=BA=E7=8E=B0=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E4=B8=BA0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game_data_processor/io_data_processor/query.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonebot_plugin_tetris_stats/game_data_processor/io_data_processor/query.py b/nonebot_plugin_tetris_stats/game_data_processor/io_data_processor/query.py index 422113d..5d21e01 100644 --- a/nonebot_plugin_tetris_stats/game_data_processor/io_data_processor/query.py +++ b/nonebot_plugin_tetris_stats/game_data_processor/io_data_processor/query.py @@ -172,9 +172,10 @@ async def query_historical_data(user: User, user_info: UserInfoSuccess) -> list[ # 按照时间排序 histories = sorted(histories, key=lambda x: x.record_at) + print(histories) for index, value in enumerate(histories): - # 在历史记录里找有没有今天0点后的数据 - if value.record_at > today: + # 在历史记录里找有没有今天0点后的数据, 并且至少要有两个数据点 + if value.record_at > today and len(histories) >= 2: # noqa: PLR2004 histories = histories[:index] + [ get_specified_point(histories[index - 1], histories[index], today.replace(microsecond=1000)) ]