Fix Tracker Status and Scores (#843)

This commit is contained in:
Mitchell Syer
2024-01-23 18:48:47 -05:00
committed by GitHub
parent 4bec027f11
commit 9121a6341c
6 changed files with 63 additions and 14 deletions

View File

@@ -99,7 +99,7 @@ object Track {
name = it.name,
icon = proxyThumbnailUrl(it.id),
statusList = it.getStatusList(),
statusTextMap = it.getStatusList().associateWith { k -> it.getStatus(k) ?: "" },
statusTextMap = it.getStatusList().associateWith { k -> it.getStatus(k).orEmpty() },
scoreList = it.getScoreList(),
record = record,
)
@@ -223,7 +223,8 @@ object Track {
}
if (input.scoreString != null) {
val score = tracker.indexToScore(tracker.getScoreList().indexOf(input.scoreString))
recordDb[TrackRecordTable.score] = score.toDouble()
// conversion issues between Float <-> Double so convert to string before double
recordDb[TrackRecordTable.score] = score.toString().toDouble()
}
if (input.startDate != null) {
recordDb[TrackRecordTable.startDate] = input.startDate

View File

@@ -50,12 +50,12 @@ class Anilist(id: Int) : Tracker(id, "AniList"), DeletableTrackService {
@StringRes
override fun getStatus(status: Int): String? =
when (status) {
READING -> "reading"
PLAN_TO_READ -> "plan_to_read"
COMPLETED -> "completed"
ON_HOLD -> "on_hold"
DROPPED -> "dropped"
REREADING -> "repeating"
READING -> "Reading"
PLAN_TO_READ -> "Plan to read"
COMPLETED -> "Completed"
ON_HOLD -> "On hold"
DROPPED -> "Dropped"
REREADING -> "Rereading"
else -> null
}

View File

@@ -46,12 +46,12 @@ class MyAnimeList(id: Int) : Tracker(id, "MyAnimeList"), DeletableTrackService {
@StringRes
override fun getStatus(status: Int): String? =
when (status) {
READING -> "reading"
PLAN_TO_READ -> "plan_to_read"
COMPLETED -> "completed"
ON_HOLD -> "on_hold"
DROPPED -> "dropped"
REREADING -> "repeating"
READING -> "Reading"
PLAN_TO_READ -> "Plan to read"
COMPLETED -> "Completed"
ON_HOLD -> "On hold"
DROPPED -> "Dropped"
REREADING -> "Rereading"
else -> null
}