fix wrong chapters being removed, fix da css

This commit is contained in:
Aria Moradi 2021-05-13 18:28:30 +04:30
parent a02dc02d52
commit 295a0817b0
2 changed files with 13 additions and 18 deletions

View File

@ -67,18 +67,20 @@ object Chapter {
} }
// clear any orphaned chapters that are in the db but not in `chapterList` // clear any orphaned chapters that are in the db but not in `chapterList`
val dbChapterCount = transaction { ChapterTable.selectAll().count() } val dbChapterCount = transaction { ChapterTable.select { ChapterTable.manga eq mangaId }.count() }
if (dbChapterCount > chapterCount) { // we got some clean up due if (dbChapterCount > chapterCount) { // we got some clean up due
// TODO: delete orphan chapters // TODO: delete orphan chapters
val dbChapterList = transaction { ChapterTable.selectAll() } val dbChapterList = transaction { ChapterTable.select { ChapterTable.manga eq mangaId } }
dbChapterList.forEach { dbChapterList.forEach {
( if (it[ChapterTable.chapterIndex] >= chapterList.size ||
it[ChapterTable.chapterIndex] >= chapterList.size || chapterList[it[ChapterTable.chapterIndex] - 1].url != it[ChapterTable.url]
chapterList[it[ChapterTable.chapterIndex]].url != it[ChapterTable.url] ) {
) transaction {
PageTable.deleteWhere { PageTable.chapter eq it[ChapterTable.id] }
ChapterTable.deleteWhere { ChapterTable.id eq it[ChapterTable.id] } ChapterTable.deleteWhere { ChapterTable.id eq it[ChapterTable.id] }
}
}
} }
} }

View File

@ -89,16 +89,9 @@ export default function Manga() {
{chapters.map((chapter) => ())} {chapters.map((chapter) => ())}
</ol> */} </ol> */}
<Virtuoso <Virtuoso
style={ style={{ // override Virtuoso default values and set them with class
{ height: 'undefined',
width: '100vw', }}
height: '100%',
[theme.breakpoints.up('md')]: {
height: 'calc(100vh - 64px)',
width: '50vw',
},
}
}
className={classes.chapters} className={classes.chapters}
totalCount={chapters.length} totalCount={chapters.length}
itemContent={itemContent} itemContent={itemContent}