diff --git a/server/index.ts b/server/index.ts index cd497e8..d9b6bc3 100644 --- a/server/index.ts +++ b/server/index.ts @@ -400,7 +400,15 @@ app.get('/api/series/:id', requireAuth, async (req, res) => { }) const total = eps.filter((e: any) => e.available).length const orgCount = eps.filter((e: any) => e.organized).length - return { ...season, torrent: seasonTorrentMapBySn[season.season_number] ?? null, organized_state: orgCount === 0 ? 'none' : orgCount >= total && total > 0 ? 'complete' : 'partial', organized_count: orgCount, episodes: eps } + const epTotal = eps.length // total réel incluant les imports manuels + const orgState = orgCount === 0 + ? 'none' + : orgCount >= epTotal + ? 'complete' + : total > 0 && orgCount >= total + ? 'complete' + : 'partial' + return { ...season, torrent: seasonTorrentMapBySn[season.season_number] ?? null, organized_state: orgState, organized_count: orgCount, episodes: eps } }) res.json({ serie, seasons: enrichedSeasons, torrents_integrale: integraleTorrents.map(t => ({ label: 'Intégrale', torrent_url: t.torrent_url, magnet: t.magnet, raw: t.title ?? t.raw })) }) } catch (err) { diff --git a/src/views/SerieView.vue b/src/views/SerieView.vue index 4982020..c82e15b 100644 --- a/src/views/SerieView.vue +++ b/src/views/SerieView.vue @@ -135,7 +135,9 @@

{{ season.episodes.length }} épisode{{ season.episodes.length > 1 ? 's' : '' }} - · {{ seasonAvailableCount(season) }}/{{ season.episodes.length }} dispo + {{ season.organized_state === 'complete' ? `✓ ${season.organized_count} importé${season.organized_count > 1 ? 's' : ''}` - : `${season.organized_count}/${seasonAvailableCount(season)} importés` }} + : `${season.organized_count}/${seasonAvailableCount(season) || season.episodes.length} importés` }}