mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 15:09:18 +01:00
Fixes: incorrect sorting when chapter name contains hyphens '-' (#7161)
* Fixes: incorrect sorting when chapter name contains hyphens '-' * Added a test case for hyphen in ChapterRecognitionTest.kt * Removed chapter range test case since it will be replaced by chapterContainingHyphensCase
This commit is contained in:
parent
1949fb1abe
commit
3e07100dc2
@ -46,8 +46,8 @@ object ChapterRecognition {
|
|||||||
// Get chapter title with lower case
|
// Get chapter title with lower case
|
||||||
var name = chapter.name.lowercase()
|
var name = chapter.name.lowercase()
|
||||||
|
|
||||||
// Remove comma's from chapter.
|
// Remove comma's or hyphens.
|
||||||
name = name.replace(',', '.')
|
name = name.replace(',', '.').replace('-', '.')
|
||||||
|
|
||||||
// Remove unwanted white spaces.
|
// Remove unwanted white spaces.
|
||||||
unwantedWhiteSpace.findAll(name).let {
|
unwantedWhiteSpace.findAll(name).let {
|
||||||
|
@ -276,16 +276,6 @@ class ChapterRecognitionTest {
|
|||||||
assertEquals(1f, chapter.chapter_number)
|
assertEquals(1f, chapter.chapter_number)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Chapter containing range
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
fun rangeInChapterCase() {
|
|
||||||
createChapter("Ch.191-200 Read Online")
|
|
||||||
ChapterRecognition.parseChapterNumber(chapter, manga)
|
|
||||||
assertEquals(191f, chapter.chapter_number)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chapter containing multiple zeros
|
* Chapter containing multiple zeros
|
||||||
*/
|
*/
|
||||||
@ -440,7 +430,27 @@ class ChapterRecognitionTest {
|
|||||||
assertEquals(24.005f, chapter.chapter_number)
|
assertEquals(24.005f, chapter.chapter_number)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Chapter title containing hyphen's
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun chapterContainingHyphensCase() {
|
||||||
|
createManga("Solo Leveling")
|
||||||
|
|
||||||
|
createChapter("ch 122-a")
|
||||||
|
ChapterRecognition.parseChapterNumber(chapter, manga)
|
||||||
|
assertEquals(122.1f, chapter.chapter_number)
|
||||||
|
|
||||||
|
createChapter("Solo Leveling Ch.123-extra")
|
||||||
|
ChapterRecognition.parseChapterNumber(chapter, manga)
|
||||||
|
assertEquals(123.99f, chapter.chapter_number)
|
||||||
|
|
||||||
|
createChapter("Solo Leveling, 024-005")
|
||||||
|
ChapterRecognition.parseChapterNumber(chapter, manga)
|
||||||
|
assertEquals(24.005f, chapter.chapter_number)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Test for chapters containing season
|
* Test for chapters containing season
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user