Skip to content

Commit e377fdb

Browse files
committed
fix: 现在刷课过程中的进度条是真的能够显示正确的数目了
1 parent c93dff4 commit e377fdb

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

app.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ def run(self):
533533
"current": state.progress["current"],
534534
"total": len(response.json()["info"]) * len(self.lessonIds),
535535
}
536-
537536
for section in response.json()["info"]: # 获取课程的小节列表并刷课
538537
log_message(
539538
f"获取到课程 {lesson} 的详细信息 {response.json()}", "APPDEBUG"
@@ -586,11 +585,7 @@ def run(self):
586585
"APPINFO",
587586
)
588587
# 第 N 类刷课法 neta 了高数的第 N 类积分法
589-
state.progress = {
590-
"current": state.progress["current"] + 1,
591-
"total": len(response.json()["info"]) * len(self.lessonIds),
592-
}
593-
# 这里假设了每个课程的节数是一样的,反正看起来好像差不多,应该无所谓
588+
state.progress["current"] += 1
594589
continue
595590
else: # 第二种刷课法
596591
response = client.post(
@@ -615,24 +610,18 @@ def run(self):
615610
f"刷课结果:以 {crate}% 的正确率使用“第二类刷课法”完成了课程 {section['location']}",
616611
"APPINFO",
617612
)
618-
state.progress = {
619-
"current": state.progress["current"] + 1,
620-
"total": len(response.json()["info"]) * len(self.lessonIds),
621-
}
613+
state.progress["current"] += 1
622614
continue
623615
else:
624-
state.progress = {
625-
"current": state.progress["current"] + 1,
626-
"total": len(response.json()["info"]) * len(self.lessonIds),
627-
}
616+
state.progress["current"] += 1
628617
log_message(f'跳过已完成课程 {section["location"]}', "APPINFO")
629618
log_message(f"课程 {lesson} 刷课完成", "APPINFO")
630619
state.task_status = "completed"
631620
except Exception as e:
632621
log_message(f"刷课任务出错: {str(e)}")
633622
state.progress = {
634-
"current": self.lessonIds * 100,
635-
"total": len(response.json()["info"]) * len(self.lessonIds)
623+
"current": 0,
624+
"total": 1
636625
}
637626
state.task_status = "error"
638627

0 commit comments

Comments
 (0)