Fix Kitsu ratingTwenty being typed as String (#1191)

The API docs and the responses type `ratingTwenty` as a "number" (Int
in Kotlin, it's divided by 2 for a .5 step scale 0-10). It's nullable
because an entry without a user rating returns `null` in that field.
This commit is contained in:
MajorTanya 2024-09-05 06:56:58 +02:00 committed by GitHub
parent c4d2fffb12
commit 001249a89d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,7 @@ data class KitsuListSearchResult(
"planned" -> Kitsu.PLAN_TO_READ
else -> throw Exception("Unknown status")
}
score = userDataAttrs.ratingTwenty?.let { it.toInt() / 2.0 } ?: 0.0
score = userDataAttrs.ratingTwenty?.let { it / 2.0 } ?: 0.0
last_chapter_read = userDataAttrs.progress.toDouble()
}
}
@ -57,7 +57,7 @@ data class KitsuListSearchItemDataAttributes(
val status: String,
val startedAt: String?,
val finishedAt: String?,
val ratingTwenty: String?,
val ratingTwenty: Int?,
val progress: Int,
)