From c5f779f72d84ad288edeed8882996584dd38ca56 Mon Sep 17 00:00:00 2001 From: foralost Date: Sun, 10 Dec 2023 22:44:23 +0100 Subject: [PATCH] Converting from int to double (3 digits of precision) --- .../java/org/isoron/uhabits/core/io/HabitsCSVExporter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uhabits-core/src/jvmMain/java/org/isoron/uhabits/core/io/HabitsCSVExporter.kt b/uhabits-core/src/jvmMain/java/org/isoron/uhabits/core/io/HabitsCSVExporter.kt index 43dad6954..019ab9516 100644 --- a/uhabits-core/src/jvmMain/java/org/isoron/uhabits/core/io/HabitsCSVExporter.kt +++ b/uhabits-core/src/jvmMain/java/org/isoron/uhabits/core/io/HabitsCSVExporter.kt @@ -124,7 +124,7 @@ class HabitsCSVExporter( val dateFormat = DateFormats.getCSVDateFormat() for ((timestamp, value) in entries.getKnown()) { val date = dateFormat.format(timestamp.toJavaDate()) - out.write(String.format(Locale.US, "%s,%d\n", date, value)) + out.write(String.format(Locale.US, "%s,%.3f\n", date, value.toDouble() / 1000.0)) } out.close() } @@ -167,7 +167,7 @@ class HabitsCSVExporter( checksWriter.write(sb.toString()) scoresWriter.write(sb.toString()) for (j in selectedHabits.indices) { - checksWriter.write(checkmarks[j][i].value.toString()) + checksWriter.write(String.format("%.3f", checkmarks[j][i].value.toDouble() / 1000.0)) checksWriter.write(delimiter) val score = String.format(Locale.US, "%.4f", scores[j][i].value) scoresWriter.write(score)