From 146af5631476d05f4c5d1022972d41468e8cdf42 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Thu, 1 Jun 2023 19:17:03 +0800 Subject: [PATCH] :sparkles: Support exam days_left --- cqwu/types/exam.py | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cqwu/types/exam.py b/cqwu/types/exam.py index 87977ab..c991265 100644 --- a/cqwu/types/exam.py +++ b/cqwu/types/exam.py @@ -25,6 +25,11 @@ class AiExam(BaseModel): """ 获取课程名称(去除课程编号) """ return self.name.split("]")[-1] + @property + def days_left(self) -> int: + """ 获取距离考试的天数 """ + return (self.get_time()[0] - datetime.datetime.now()).days + def get_time(self) -> Tuple[datetime.datetime, datetime.datetime]: """ 获取格式化后的考试时间 """ # 2023-06-25(18周 星期日)09:00-11:00 diff --git a/setup.py b/setup.py index c9beae2..90ffc77 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setuptools.setup( name="cqwu", # 用自己的名替换其中的YOUR_USERNAME_ - version="0.0.11", # 包版本号,便于维护版本 + version="0.0.12", # 包版本号,便于维护版本 author="omg-xtao", # 作者,可以写自己的姓名 author_email="xtao@xtaolink.cn", # 作者联系方式,可写自己的邮箱地址 description="A cqwu ehall client.", # 包的简述