fix(media-detail): 季集数为 0 时不渲染存在状态标签,避免误导性显示已入库

- 剧集详情季列表:当季 episode_count 为 0 时隐藏已入库/缺失状态标签
- 补充回归测试
This commit is contained in:
jxxghp
2026-08-20 08:19:37 +08:00
parent dab2b9d5bd
commit 281e36c6d3
2 changed files with 27 additions and 1 deletions
+5 -1
View File
@@ -1083,7 +1083,11 @@ onUnmounted(() => {
{{ t('media.episodeCount', { count: season.episode_count }) }}
</VChip>
<div class="absolute right-12">
<VChip v-if="seasonsNotExisted" :color="getExistColor(season.season_number || 0)" flat>
<VChip
v-if="seasonsNotExisted && (season.episode_count ?? 0) > 0"
:color="getExistColor(season.season_number || 0)"
flat
>
{{ getExistText(season.season_number || 0) }}
</VChip>
<IconBtn
@@ -777,6 +777,28 @@ describe('MediaDetailView subscriptions, seasons, and episode groups', () => {
})
})
it('hides the status badge for a season with zero episodes', async () => {
const media = createSubscribeTv({
season_info: [
createMediaSeason({ episode_count: 0, season_number: 1 }),
createMediaSeason({ episode_count: 2, season_number: 2 }),
],
title: '零集数状态剧',
tmdb_id: 8710,
})
const notExists = [createNotExistMediaInfo({ episodes: [1, 2], season: 2, total_episode: 2 })]
const { container } = await renderDetail({ media, notExists, type: '电视剧' })
await waitFor(() => {
const panels = [...container.querySelectorAll<HTMLElement>('.v-expansion-panel')]
expect(panels).toHaveLength(2)
// 集数为 0 的季不渲染任何存在状态标签
expect(panels[0].textContent).toMatch(/第 1 季/)
expect(panels[0].textContent).not.toMatch(/已入库|缺失/)
expect(panels[1].textContent).toMatch(/ 2 .*/s)
})
})
it('loads season episodes and marks episodes that already exist remotely', async () => {
const media = createSubscribeTv({
season_info: [createMediaSeason({ episode_count: 2, season_number: 1 })],