Skip to content

Commit

Permalink
Fix Kitsu ratingTwenty being typed as String (mihonapp/mihon#1191)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 001249a)
  • Loading branch information
MajorTanya authored and cuong-tran committed Sep 5, 2024
1 parent 1b637c9 commit 586001c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand All @@ -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,
)

Expand Down

0 comments on commit 586001c

Please sign in to comment.