fix:修复伏笔统计页面计算最大章节号包含无内容章节的问题

This commit is contained in:
xiamuceer-j
2026-02-12 12:40:38 +08:00
parent 84a07dbf3e
commit 74a5875838
+4 -3
View File
@@ -126,9 +126,10 @@ export default function Foreshadows() {
const loadStats = useCallback(async () => {
if (!projectId) return;
try {
// 获取当前最大章节号
const maxChapter = chapters.length > 0
? Math.max(...chapters.map(c => c.chapter_number))
// 获取当前最大章节号(只计算有内容的章节,与表格显示逻辑保持一致)
const chaptersWithContent = chapters.filter(c => c.content);
const maxChapter = chaptersWithContent.length > 0
? Math.max(...chaptersWithContent.map(c => c.chapter_number))
: undefined;
const statsData = await foreshadowApi.getForeshadowStats(projectId, maxChapter);
setStats(statsData);