Don't send full Doubles to Comick for progress (#4090)
Previously, user could end up with progress displays like 35.019996643066406/100 because Mihon was sending raw Doubles/simply stringified Doubles for progress data. We now round to 2 decimal places & trim off any trailing zeroes such that integers are sent as "1" instead of "1.0" while retaining "25.5" and "41.02" as such.
This commit is contained in:
@@ -35,6 +35,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
### Removed
|
### Removed
|
||||||
- Remove "Custom hardware bitmap threshold" and "Custom display profile" advanced settings ([@wwww-wwww](https://github.com/wwww-wwww)) ([#3786](https://github.com/mihonapp/mihon/pull/3786))
|
- Remove "Custom hardware bitmap threshold" and "Custom display profile" advanced settings ([@wwww-wwww](https://github.com/wwww-wwww)) ([#3786](https://github.com/mihonapp/mihon/pull/3786))
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fix long floating point numbers showing up in Comick progress ([@MajorTanya](https://github.com/MajorTanya)) ([#4090](https://github.com/mihonapp/mihon/pull/4090))
|
||||||
|
|
||||||
## [v0.21.1] - 2026-10-12
|
## [v0.21.1] - 2026-10-12
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed refreshing chapters failing with the app language set to Arabic or another language with its own digits ([@AntsyLich](https://github.com/AntsyLich)) ([`8457fb9`](https://github.com/mihonapp/mihon/commit/8457fb9))
|
- Fixed refreshing chapters failing with the app language set to Arabic or another language with its own digits ([@AntsyLich](https://github.com/AntsyLich)) ([`8457fb9`](https://github.com/mihonapp/mihon/commit/8457fb9))
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import okhttp3.Request
|
|||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.math.RoundingMode
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
@@ -77,7 +78,14 @@ class ComickApi(
|
|||||||
put("status", track.status.toApiListStatus())
|
put("status", track.status.toApiListStatus())
|
||||||
if (track.last_chapter_read > 0) {
|
if (track.last_chapter_read > 0) {
|
||||||
putJsonObject("progress") {
|
putJsonObject("progress") {
|
||||||
put("number", track.last_chapter_read)
|
put(
|
||||||
|
"number",
|
||||||
|
track.last_chapter_read
|
||||||
|
.toBigDecimal()
|
||||||
|
.setScale(2, RoundingMode.HALF_UP)
|
||||||
|
.stripTrailingZeros()
|
||||||
|
.toPlainString(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
put("progress", null)
|
put("progress", null)
|
||||||
@@ -140,7 +148,14 @@ class ComickApi(
|
|||||||
put("rating", track.score.toInt().takeIf { it > 0 })
|
put("rating", track.score.toInt().takeIf { it > 0 })
|
||||||
put("status", track.status.toApiListStatus())
|
put("status", track.status.toApiListStatus())
|
||||||
putJsonObject("progress") {
|
putJsonObject("progress") {
|
||||||
put("number", track.last_chapter_read.toString())
|
put(
|
||||||
|
"number",
|
||||||
|
track.last_chapter_read
|
||||||
|
.toBigDecimal()
|
||||||
|
.setScale(2, RoundingMode.HALF_UP)
|
||||||
|
.stripTrailingZeros()
|
||||||
|
.toPlainString(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toString()
|
.toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user