From d1fb4fb1642cb449d7ad01d120c6a37126d004f4 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 20 Jan 2026 10:24:27 +0800 Subject: [PATCH] update --- src/shared/store/loginSummary.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/shared/store/loginSummary.ts b/src/shared/store/loginSummary.ts index e57d924..36c1cad 100644 --- a/src/shared/store/loginSummary.ts +++ b/src/shared/store/loginSummary.ts @@ -17,6 +17,21 @@ export const useLoginSummaryStore = defineStore("loginSummary", () => { const analysis = ref("") const analysisError = ref("") + function shouldShowSummary(nextSummary: LoginSummary | null) { + if (!nextSummary) { + return false + } + const values = [ + nextSummary.new_problem_count, + nextSummary.submission_count, + nextSummary.accepted_count, + nextSummary.solved_count, + nextSummary.flowchart_submission_count, + ] + const zeroCount = values.filter((value) => value === 0).length + return zeroCount < Math.floor(values.length / 2) + 1 + } + async function fetchSummary() { loading.value = true analysis.value = "" @@ -34,8 +49,12 @@ export const useLoginSummaryStore = defineStore("loginSummary", () => { } async function open() { - show.value = true await fetchSummary() + if (!summary.value && analysisError.value) { + show.value = true + return + } + show.value = shouldShowSummary(summary.value) } function close() {