fix: 停止后本月学时不再被旧缓存和实时数字来回改

This commit is contained in:
2026-11-17 12:01:03 +08:00
parent 361bdcb87b
commit e30e2321e7
+5 -1
View File
@@ -259,6 +259,9 @@ async function loadSummary() {
if (!hadData) summaryState.value = "error"; if (!hadData) summaryState.value = "error";
return; return;
} }
const studying = studyControl.value.active || studyControl.value.started;
if (studying && progressHours.value) parsed.month_hours = progressHours.value;
else if (parsed.month_hours) progressHours.value = parsed.month_hours;
summary.value = parsed; summary.value = parsed;
avatarBroken.value = false; avatarBroken.value = false;
summaryError.value = ""; summaryError.value = "";
@@ -560,7 +563,8 @@ function applyStudyControl(payload: Record<string, unknown>) {
message: typeof payload.message === "string" ? payload.message : "", message: typeof payload.message === "string" ? payload.message : "",
workers: asWorkers(payload.workers), workers: asWorkers(payload.workers),
}; };
if (typeof payload.month_hours === "string") { const studying = payload.active === true || payload.started === true;
if (studying && typeof payload.month_hours === "string" && payload.month_hours) {
progressHours.value = payload.month_hours; progressHours.value = payload.month_hours;
if (summary.value) summary.value = { ...summary.value, month_hours: payload.month_hours }; if (summary.value) summary.value = { ...summary.value, month_hours: payload.month_hours };
} }