fix: 课程进度改为跟着官方的百分比和已学分钟
This commit is contained in:
@@ -166,22 +166,53 @@ def test_rejected_heartbeat_waits_for_platform_chunk_instead_of_failing() -> Non
|
||||
assert stall.quiet(1701) is True
|
||||
|
||||
|
||||
def test_accepted_but_flat_heartbeat_still_gives_up() -> None:
|
||||
def test_unchanged_official_percent_is_not_new_progress() -> None:
|
||||
stall = _Stall()
|
||||
for _ in range(9):
|
||||
for offset in range(12):
|
||||
landed, give_up, pause = _pace_after(
|
||||
stall, 10, 10, 1, 1, {"studySchedule": 10},
|
||||
video=True, step=30, interval=1, now=1000,
|
||||
stall, 1.85, 1.85, 1, 1, {"studySchedule": 1.85},
|
||||
video=True, step=30, interval=1, now=1000 + offset,
|
||||
)
|
||||
assert landed is True
|
||||
assert landed is False
|
||||
assert give_up is False
|
||||
assert pause == 1
|
||||
landed, give_up, _pause = _pace_after(
|
||||
stall, 10, 10, 1, 1, {"studySchedule": 10},
|
||||
video=True, step=30, interval=1, now=1000,
|
||||
assert pause == 30
|
||||
|
||||
|
||||
def test_worker_adopts_official_minutes_and_percent() -> None:
|
||||
from euniv.autostudy import WorkerView
|
||||
|
||||
_clear_user_status("u-official")
|
||||
view = WorkerView("u-official", 1)
|
||||
view.adopt(
|
||||
{
|
||||
"studyschedule": 1.85,
|
||||
"actualstudyhours": 1,
|
||||
"standardstudyhours": 54,
|
||||
"status": "Studying",
|
||||
},
|
||||
course="甲",
|
||||
knowledge_id="k-official",
|
||||
ok=True,
|
||||
)
|
||||
assert landed is True
|
||||
assert give_up is True
|
||||
row = autostudy_status()["users"]["u-official"]["workers"][0]
|
||||
assert row["progress"] == 1.85
|
||||
assert row["sent"] == 1
|
||||
assert row["total"] == 54
|
||||
view.adopt(
|
||||
{
|
||||
"studyschedule": 100,
|
||||
"actualstudyhours": 3,
|
||||
"standardstudyhours": 3,
|
||||
"status": "Completed",
|
||||
},
|
||||
knowledge_id="k-official",
|
||||
ok=True,
|
||||
)
|
||||
row = autostudy_status()["users"]["u-official"]["workers"][0]
|
||||
assert row["progress"] == 100
|
||||
assert row["sent"] == 3
|
||||
assert row["total"] == 3
|
||||
_clear_user_status("u-official")
|
||||
|
||||
|
||||
def test_fast_video_survives_a_burst_of_empty_heartbeats(monkeypatch) -> None:
|
||||
|
||||
Reference in New Issue
Block a user