Skip to content

Commit

Permalink
Converting from int to double (3 digits of precision)
Browse files Browse the repository at this point in the history
  • Loading branch information
foralost committed Dec 10, 2023
1 parent 359e3c9 commit 7a6873e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,%.4f\n", date, value.toDouble() / 1000.0))
}
out.close()
}
Expand Down Expand Up @@ -167,7 +167,8 @@ class HabitsCSVExporter(
checksWriter.write(sb.toString())
scoresWriter.write(sb.toString())
for (j in selectedHabits.indices) {
checksWriter.write(checkmarks[j][i].value.toString())
val convertedValue = checkmarks[j][i].value.toDouble() / 1000.0
checksWriter.write(convertedValue.toString())
checksWriter.write(delimiter)
val score = String.format(Locale.US, "%.4f", scores[j][i].value)
scoresWriter.write(score)
Expand Down

0 comments on commit 7a6873e

Please sign in to comment.