[skip ci] Formatting

This commit is contained in:
Syer10
2024-09-03 21:37:18 -04:00
parent e968a2195a
commit 6c1fbfa63b
220 changed files with 2493 additions and 2519 deletions

View File

@@ -49,8 +49,8 @@ data class ChapterDataClass(
fetchedAt: Long,
mangaId: Int,
realUrl: String?,
): ChapterDataClass {
return ChapterDataClass(
): ChapterDataClass =
ChapterDataClass(
id = id,
url = sChapter.url,
name = sChapter.name,
@@ -67,6 +67,5 @@ data class ChapterDataClass(
lastReadAt = 0,
downloaded = false,
)
}
}
}

View File

@@ -44,9 +44,7 @@ data class MangaDataClass(
val chaptersAge: Long? = if (chaptersLastFetchedAt == null) null else Instant.now().epochSecond.minus(chaptersLastFetchedAt),
val trackers: List<MangaTrackerDataClass>? = null,
) {
override fun toString(): String {
return "\"$title\" (id= $id) (sourceId= $sourceId)"
}
override fun toString(): String = "\"$title\" (id= $id) (sourceId= $sourceId)"
}
data class PagedMangaListDataClass(

View File

@@ -69,7 +69,9 @@ fun MangaTable.toDataClass(mangaEntry: ResultRow) =
updateStrategy = UpdateStrategy.valueOf(mangaEntry[updateStrategy]),
)
enum class MangaStatus(val value: Int) {
enum class MangaStatus(
val value: Int,
) {
UNKNOWN(0),
ONGOING(1),
COMPLETED(2),

View File

@@ -37,9 +37,10 @@ fun List<TrackSearch>.insertAll(): List<ResultRow> {
val remoteIds = map { it.media_id }.toSet()
val existing =
transaction {
TrackSearchTable.select {
TrackSearchTable.trackerId inList trackerIds and (TrackSearchTable.remoteId inList remoteIds)
}.toList()
TrackSearchTable
.select {
TrackSearchTable.trackerId inList trackerIds and (TrackSearchTable.remoteId inList remoteIds)
}.toList()
}
val grouped = mutableMapOf<Boolean, MutableList<Pair<Int?, TrackSearch>>>()
@@ -49,7 +50,8 @@ fun List<TrackSearch>.insertAll(): List<ResultRow> {
it[TrackSearchTable.trackerId] == trackSearch.sync_id &&
it[TrackSearchTable.remoteId] == trackSearch.media_id
}
grouped.getOrPut(existingRow != null) { mutableListOf() }
grouped
.getOrPut(existingRow != null) { mutableListOf() }
.add(existingRow?.get(TrackSearchTable.id)?.value to trackSearch)
}
val toUpdate = grouped[true]
@@ -90,9 +92,11 @@ fun List<TrackSearch>.insertAll(): List<ResultRow> {
}
val updatedRows =
toUpdate?.mapNotNull { it.first }?.let { ids ->
transaction { TrackSearchTable.select { TrackSearchTable.id inList ids }.toList() }
}.orEmpty()
toUpdate
?.mapNotNull { it.first }
?.let { ids ->
transaction { TrackSearchTable.select { TrackSearchTable.id inList ids }.toList() }
}.orEmpty()
(insertedRows + updatedRows)
.sortedBy { row ->