diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/anilist/data/ScoreFormat.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/anilist/data/ScoreFormat.kt index 47b7bcadf..45a1ad85d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/anilist/data/ScoreFormat.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/anilist/data/ScoreFormat.kt @@ -13,7 +13,7 @@ enum class ScoreFormat { POINT_5 -> score / 5f POINT_3 -> score / 3f - } + }.coerceIn(0f, 1f) companion object { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/mal/data/MALRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/mal/data/MALRepository.kt index 877cbabf5..84d39309f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/mal/data/MALRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/mal/data/MALRepository.kt @@ -173,7 +173,7 @@ class MALRepository @Inject constructor( status = json.getString("status"), chapter = json.getInt("num_chapters_read"), comment = json.getString("comments"), - rating = json.getDouble("score").toFloat() / 10f, + rating = (json.getDouble("score").toFloat() / 10f).coerceIn(0f, 1f), ) db.scrobblingDao.upsert(entity) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/shikimori/data/ShikimoriRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/shikimori/data/ShikimoriRepository.kt index e61791deb..3f833596b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/shikimori/data/ShikimoriRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/shikimori/data/ShikimoriRepository.kt @@ -190,7 +190,7 @@ class ShikimoriRepository @Inject constructor( status = json.getString("status"), chapter = json.getInt("chapters"), comment = json.getString("text"), - rating = json.getDouble("score").toFloat() / 10f, + rating = (json.getDouble("score").toFloat() / 10f).coerceIn(0f, 1f), ) db.scrobblingDao.upsert(entity) }