fix:修复伏笔统计页面计算最大章节号包含无内容章节的问题
This commit is contained in:
@@ -126,9 +126,10 @@ export default function Foreshadows() {
|
|||||||
const loadStats = useCallback(async () => {
|
const loadStats = useCallback(async () => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
try {
|
try {
|
||||||
// 获取当前最大章节号
|
// 获取当前最大章节号(只计算有内容的章节,与表格显示逻辑保持一致)
|
||||||
const maxChapter = chapters.length > 0
|
const chaptersWithContent = chapters.filter(c => c.content);
|
||||||
? Math.max(...chapters.map(c => c.chapter_number))
|
const maxChapter = chaptersWithContent.length > 0
|
||||||
|
? Math.max(...chaptersWithContent.map(c => c.chapter_number))
|
||||||
: undefined;
|
: undefined;
|
||||||
const statsData = await foreshadowApi.getForeshadowStats(projectId, maxChapter);
|
const statsData = await foreshadowApi.getForeshadowStats(projectId, maxChapter);
|
||||||
setStats(statsData);
|
setStats(statsData);
|
||||||
|
|||||||
Reference in New Issue
Block a user