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`
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
// TODO: delete orphan chapters
val dbChapterList = transaction { ChapterTable.selectAll() }
val dbChapterList = transaction { ChapterTable.select { ChapterTable.manga eq mangaId } }
dbChapterList.forEach {
(
it[ChapterTable.chapterIndex] >= chapterList.size ||
chapterList[it[ChapterTable.chapterIndex]].url != it[ChapterTable.url]
)
ChapterTable.deleteWhere { ChapterTable.id eq it[ChapterTable.id] }
if (it[ChapterTable.chapterIndex] >= chapterList.size ||
chapterList[it[ChapterTable.chapterIndex] - 1].url != it[ChapterTable.url]
) {
transaction {
PageTable.deleteWhere { PageTable.chapter 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) => ())}
</ol> */}
<Virtuoso
style={
{
width: '100vw',
height: '100%',
[theme.breakpoints.up('md')]: {
height: 'calc(100vh - 64px)',
width: '50vw',
},
}
}
style={{ // override Virtuoso default values and set them with class
height: 'undefined',
}}
className={classes.chapters}
totalCount={chapters.length}
itemContent={itemContent}