From e1a3a74752bb6d457846540d8dc83c47fd4d640b Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Mon, 15 Sep 2025 02:00:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=88=97=E8=A1=A8=E8=A7=86=E5=9B=BE=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E9=9B=86=E6=95=B0=E7=BB=9F=E8=AE=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 getTaskSeasonCounts 函数,使其支持 progressByTaskName 映射 - 支持基于日期的集数统计,与海报视图保持一致 - 修复排序逻辑中的集数计算问题 - 确保列表视图和海报视图的集数统计数据一致 问题:任务列表列表视图下没有正确获取基于日期的集数统计,排序时也被视作0 解决:让 getTaskSeasonCounts 函数优先使用 progressByTaskName 映射,支持基于日期的集数查找 --- app/templates/index.html | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/templates/index.html b/app/templates/index.html index 8610c9b..126e65e 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -3983,7 +3983,34 @@ const t = this.calendar.tasks.find(x => (x.task_name || x.taskname) === taskName); if (!t || !t.season_counts) return null; const sc = t.season_counts || {}; - const transferred = Number(sc.transferred_count || 0); + + // 优先使用 progressByTaskName 映射获取已转存集数(支持基于日期的集数统计) + let transferred = Number(sc.transferred_count || 0); + const byTask = this.calendar && this.calendar.progressByTaskName ? this.calendar.progressByTaskName : {}; + if (byTask[taskName]) { + const prog = byTask[taskName] || {}; + if (prog.episode_number != null) { + transferred = Number(prog.episode_number) || 0; + } else if (prog.air_date) { + // 仅有日期:直接在本地DB剧集里找到"该节目在该日期播出的那一集"的集号 + const showName = (t.matched_show_name || t.show_name || '').trim(); + if (showName && Array.isArray(this.calendar.episodes) && this.calendar.episodes.length > 0) { + const date = String(prog.air_date).trim(); + // 找到该节目在该日期播出的所有集,取最大集号作为"已转存集数" + const candidates = this.calendar.episodes.filter(e => { + return e && (e.show_name || '').trim() === showName && (e.air_date || '').trim() === date; + }); + if (candidates.length > 0) { + const maxEp = candidates.reduce((m, e) => { + const n = parseInt(e.episode_number); + return isNaN(n) ? m : Math.max(m, n); + }, 0); + if (maxEp > 0) transferred = maxEp; + } + } + } + } + const aired = Number(sc.aired_count || 0); const total = Number(sc.total_count || 0); if (transferred === 0 && aired === 0 && total === 0) return null;