소스 검색

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
Ian Harmon 6 년 전
부모
커밋
5f568733f3

+ 13 - 4
app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt

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

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistModels.kt

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