Fixed bug where it was always determined to be the first run.
This commit is contained in:
@@ -136,21 +136,45 @@ integrated_grade_info += f"\n" f"MD5:{encrypted_integrated_grade_info}"
|
||||
selected_courses_filtering = get_selected_courses(student_client)
|
||||
|
||||
# 工作流信息
|
||||
workflow_info = f"------\n" f"工作流信息:\n" f"Force Push Message:{force_push_message}\n" f"Triggered By:{github_event_name}\n" f"Run By:{github_triggering_actor}\n" f"Repository Name:{repository_name}\n" f"Commit SHA:{github_sha}\n" f"Workflow Name:{github_workflow}\n" f"Workflow Number:{github_run_number}\n" f"Workflow ID:{github_run_id}\n" f"Beijing Time:{beijing_time}"
|
||||
workflow_info = (
|
||||
f"------\n"
|
||||
f"工作流信息:\n"
|
||||
f"Force Push Message:{force_push_message}\n"
|
||||
f"Triggered By:{github_event_name}\n"
|
||||
f"Run By:{github_triggering_actor}\n"
|
||||
f"Repository Name:{repository_name}\n"
|
||||
f"Commit SHA:{github_sha}\n"
|
||||
f"Workflow Name:{github_workflow}\n"
|
||||
f"Workflow Number:{github_run_number}\n"
|
||||
f"Workflow ID:{github_run_id}\n"
|
||||
f"Beijing Time:{beijing_time}"
|
||||
)
|
||||
|
||||
# 第一次运行时的提示文本
|
||||
first_run_text = "你的程序运行成功\n" "从现在开始,程序将会每隔 30 分钟自动检测一次成绩是否有更新\n" "若有更新,将通过微信推送及时通知你\n" "------"
|
||||
first_run_text = (
|
||||
"你的程序运行成功\n"
|
||||
"从现在开始,程序将会每隔 30 分钟自动检测一次成绩是否有更新\n"
|
||||
"若有更新,将通过微信推送及时通知你\n"
|
||||
"------"
|
||||
)
|
||||
|
||||
# 整合所有信息
|
||||
# 注意此处integrated_send_info保存的是未加密的信息,仅用于信息推送
|
||||
# 若是在 Github Actions 等平台运行,请不要使用print(integrated_send_info)
|
||||
integrated_send_info = f"{integrated_info}\n" f"{integrated_grade_info}\n" f"{selected_courses_filtering}\n" f"{workflow_info if github_actions else current_time}"
|
||||
integrated_send_info = (
|
||||
f"{integrated_info}\n"
|
||||
f"{integrated_grade_info}\n"
|
||||
f"{selected_courses_filtering}\n"
|
||||
f"{workflow_info if github_actions else current_time}"
|
||||
)
|
||||
|
||||
# 整合首次运行时需要使用到的所有信息
|
||||
first_time_run_integrated_send_info = f"{first_run_text}\n" f"{integrated_send_info}"
|
||||
|
||||
# 整合成绩已更新时需要使用到的所有信息
|
||||
grades_updated_push_integrated_send_info = f"{'强制推送信息成功' if force_push_message else '教务管理系统成绩已更新'}\n" f"------\n" f"{integrated_send_info}"
|
||||
grades_updated_push_integrated_send_info = (
|
||||
f"{'强制推送信息成功' if force_push_message else '教务管理系统成绩已更新'}\n" f"------\n" f"{integrated_send_info}"
|
||||
)
|
||||
|
||||
# 如果是第一次运行,则提示程序运行成功
|
||||
if run_count == 2:
|
||||
@@ -194,7 +218,7 @@ else:
|
||||
with open(info_file_path, "r") as info_file:
|
||||
info_file_content = info_file.read()
|
||||
if info_file_content != encrypted_info:
|
||||
with open("info.txt", "w") as info_file:
|
||||
with open(info_file_path, "w") as info_file:
|
||||
info_file.write(encrypted_info)
|
||||
|
||||
# 输出运行日志
|
||||
|
||||
Reference in New Issue
Block a user