mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-18 02:03:33 -05:00
[skip ci] Formatting
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user