Optimize code structure to improve code readability and maintainability.

This commit is contained in:
NianBroken
2024-05-06 20:46:28 +08:00 Unverified
parent 91344e99ab
commit c492f86356
6 changed files with 72 additions and 69 deletions
+6 -1
View File
@@ -8,6 +8,7 @@ from get_info import get_info
from get_grade import get_grade
from get_selected_courses import get_selected_courses
from pushplus import send_message
from datetime import datetime
# MD5加密
@@ -47,6 +48,9 @@ run_count = 2
# 初始化运行日志
run_log = ""
# 当前时间
current_time = "------\n" + datetime.now().strftime("%Y-%m-%d %H:%M:%S:%f")[:-3]
# 登录
student_client = login(url, username, password)
@@ -98,6 +102,7 @@ for _ in range(run_count):
with open(grade_file_path, "w") as grade_file:
grade_file.truncate()
# 获取整合后的成绩信息
integrated_grade_info = get_grade(
student_client, output_type="integrated_grade_info"
)
@@ -155,7 +160,7 @@ integrated_send_info = (
f"{integrated_info}\n"
f"{integrated_grade_info}\n"
f"{selected_courses_filtering}\n"
f"{workflow_info}"
f"{workflow_info if github_actions else current_time}"
)
# 整合首次运行时需要使用到的所有信息