AniList 5-star/smiley <-> 100-point values differ from the AniList website (#1631)

* adjusted anilist alternate rating values to match website

* addition to: adjusted anilist alternate rating values to match website
This commit is contained in:
Ian Harmon 2018-09-27 13:20:37 -04:00 committed by inorichi
parent 96340de17d
commit 5f568733f3
2 changed files with 14 additions and 5 deletions

View file

@ -95,9 +95,15 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
// 100 point // 100 point
POINT_100 -> index.toFloat() POINT_100 -> index.toFloat()
// 5 stars // 5 stars
POINT_5 -> index * 20f POINT_5 -> when {
index == 0 -> 0f
else -> index * 20f - 10f
}
// Smiley // Smiley
POINT_3 -> index * 30f POINT_3 -> when {
index == 0 -> 0f
else -> index * 25f + 10f
}
// 10 point decimal // 10 point decimal
POINT_10_DECIMAL -> index.toFloat() POINT_10_DECIMAL -> index.toFloat()
else -> throw Exception("Unknown score type") else -> throw Exception("Unknown score type")
@ -108,10 +114,13 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
val score = track.score val score = track.score
return when (scorePreference.getOrDefault()) { return when (scorePreference.getOrDefault()) {
POINT_5 -> "${(score / 20).toInt()}" POINT_5 -> when {
score == 0f -> "0 ★"
else -> "${((score + 10) / 20).toInt()}"
}
POINT_3 -> when { POINT_3 -> when {
score == 0f -> "0" score == 0f -> "0"
score <= 30 -> "😦" score <= 35 -> "😦"
score <= 60 -> "😐" score <= 60 -> "😐"
else -> "😊" else -> "😊"
} }

View file

@ -97,7 +97,7 @@ fun Track.toAnilistScore(): String = when (preferences.anilistScoreType().getOrD
// Smiley // Smiley
"POINT_3" -> when { "POINT_3" -> when {
score == 0f -> "0" score == 0f -> "0"
score <= 30 -> ":(" score <= 35 -> ":("
score <= 60 -> ":|" score <= 60 -> ":|"
else -> ":)" else -> ":)"
} }