Fix scrobbling rating
This commit is contained in:
@@ -13,7 +13,7 @@ enum class ScoreFormat {
|
||||
|
||||
POINT_5 -> score / 5f
|
||||
POINT_3 -> score / 3f
|
||||
}
|
||||
}.coerceIn(0f, 1f)
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user