From 1ca9b0efb817b54948436e19906de9a5a2dca6b2 Mon Sep 17 00:00:00 2001 From: MajorTanya <39014446+MajorTanya@users.noreply.github.com> Date: Mon, 12 Oct 2026 14:27:25 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 3 +++ .../tachiyomi/data/track/comick/ComickApi.kt | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adc72b9ad..3db7ee134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co ### 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)) +### 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 ### 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)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/comick/ComickApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/comick/ComickApi.kt index b3e644677..88f85f6b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/comick/ComickApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/comick/ComickApi.kt @@ -33,6 +33,7 @@ import okhttp3.Request import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody import uy.kohesive.injekt.injectLazy +import java.math.RoundingMode import java.security.SecureRandom import java.util.Base64 import kotlin.time.Duration.Companion.minutes @@ -77,7 +78,14 @@ class ComickApi( put("status", track.status.toApiListStatus()) if (track.last_chapter_read > 0) { putJsonObject("progress") { - put("number", track.last_chapter_read) + put( + "number", + track.last_chapter_read + .toBigDecimal() + .setScale(2, RoundingMode.HALF_UP) + .stripTrailingZeros() + .toPlainString(), + ) } } else { put("progress", null) @@ -140,7 +148,14 @@ class ComickApi( put("rating", track.score.toInt().takeIf { it > 0 }) put("status", track.status.toApiListStatus()) putJsonObject("progress") { - put("number", track.last_chapter_read.toString()) + put( + "number", + track.last_chapter_read + .toBigDecimal() + .setScale(2, RoundingMode.HALF_UP) + .stripTrailingZeros() + .toPlainString(), + ) } } .toString()