From d963710672261fe4162d06baef62317b623f9f57 Mon Sep 17 00:00:00 2001 From: Nixevol Date: Mon, 16 Nov 2026 01:21:22 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8E=BB=E6=8E=89=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E4=B8=8D=E7=94=A8=E7=9A=84=E5=AD=A6=E4=B9=A0=E8=BD=AE=E8=AF=A2?= =?UTF-8?q?=E9=97=B4=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/test_study_poll.py | 19 ------------------- web/src/shared/studyFields.ts | 9 --------- 2 files changed, 28 deletions(-) delete mode 100644 backend/tests/test_study_poll.py diff --git a/backend/tests/test_study_poll.py b/backend/tests/test_study_poll.py deleted file mode 100644 index bafd6ef..0000000 --- a/backend/tests/test_study_poll.py +++ /dev/null @@ -1,19 +0,0 @@ -"""与 web/src/shared/studyFields.ts 的 studyPollSeconds 保持一致。""" - - -def study_poll_seconds(intervals: list[int]) -> int: - if any(value <= 0 for value in intervals): - return 10 - positive = [value for value in intervals if value > 0] - if not positive: - return 10 - return max(10, min(positive)) - - -def test_study_poll_seconds_floor_and_zero() -> None: - assert study_poll_seconds([]) == 10 - assert study_poll_seconds([0]) == 10 - assert study_poll_seconds([0, 30]) == 10 - assert study_poll_seconds([5]) == 10 - assert study_poll_seconds([30]) == 30 - assert study_poll_seconds([30, 120]) == 30 diff --git a/web/src/shared/studyFields.ts b/web/src/shared/studyFields.ts index 3260708..c5848de 100644 --- a/web/src/shared/studyFields.ts +++ b/web/src/shared/studyFields.ts @@ -15,12 +15,3 @@ export const dayOptions = Array.from({ length: 31 }, (_, index) => ({ label: `每月 ${index + 1}号`, value: index + 1, })); - -export const STUDY_POLL_FLOOR = 10; - -export function studyPollSeconds(intervals: number[]): number { - if (intervals.some((value) => value <= 0)) return STUDY_POLL_FLOOR; - const positive = intervals.filter((value) => value > 0); - if (!positive.length) return STUDY_POLL_FLOOR; - return Math.max(STUDY_POLL_FLOOR, Math.min(...positive)); -}