fix: volume gap filling for chapter transitions between different volumes
All checks were successful
Deploy / deploy (push) Successful in 3m3s
All checks were successful
Deploy / deploy (push) Successful in 3m3s
`fillVolumeGaps` incorrectly left chapters null when surrounded by two different non-null volumes (e.g. Vol10 → null → Vol11). Simplify the condition to always prefer the previous volume, covering all cases. Also fix `InMemoryMangaRepository::findExistingChaptersByNumbers` to return an array keyed by chapter number, matching the Doctrine contract. Add 5 unit tests for MangadxChapterSynchronizationService covering volume transitions, start-of-series gaps, explicit volumes, FR/EN priority, and deduplication of existing chapters.
This commit is contained in:
parent
465a05c13b
commit
d4e456961a
@@ -204,8 +204,9 @@ readonly class MangadxChapterSynchronizationService implements ChapterSynchroniz
|
||||
}
|
||||
}
|
||||
|
||||
// Si on a trouvé un volume précédent et que le suivant est le même ou null, alors utilise le précédent
|
||||
if ($prevVolume !== null && ($nextVolume === null || $nextVolume === $prevVolume)) {
|
||||
// Priorité au volume précédent : le chapitre appartient à la fin du volume en cours
|
||||
// Couvre les cas : milieu de volume (prev=next), transition entre deux volumes (prev≠next)
|
||||
if ($prevVolume !== null) {
|
||||
$chaptersByNumber[$currentChapterNum] = new Chapter(
|
||||
new ChapterId($currentChapter->getId()),
|
||||
$currentChapter->getMangaId(),
|
||||
@@ -218,8 +219,8 @@ readonly class MangadxChapterSynchronizationService implements ChapterSynchroniz
|
||||
$currentChapter->getCreatedAt()
|
||||
);
|
||||
}
|
||||
// Si on a trouvé un volume suivant mais pas de précédent, utilise le suivant
|
||||
elseif ($nextVolume !== null && $prevVolume === null) {
|
||||
// Sinon utilise le volume suivant (chapitres en début de série)
|
||||
elseif ($nextVolume !== null) {
|
||||
$chaptersByNumber[$currentChapterNum] = new Chapter(
|
||||
new ChapterId($currentChapter->getId()),
|
||||
$currentChapter->getMangaId(),
|
||||
|
||||
Reference in New Issue
Block a user