Skip to content

Commit 187ff7f

Browse files
committed
Removed double precision in progress bar
1 parent 2d80f4a commit 187ff7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/ota-api/dto.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func buildSimpleProgressBar(progress float64, fw_size int64) string {
234234
bar.WriteString(strings.Repeat("=", progressInt))
235235
bar.WriteString(strings.Repeat(" ", maxProgress-progressInt))
236236
bar.WriteString("] ")
237-
bar.WriteString(strconv.FormatFloat(progress, 'f', 2, 64))
237+
bar.WriteString(strconv.FormatFloat(progress, 'f', 0, 64))
238238
bar.WriteString("% (firmware size: ")
239239
bar.WriteString(strconv.FormatInt(fw_size, 10))
240240
bar.WriteString(" bytes)")

internal/ota-api/dto_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
func TestProgressBar_notCompletePct(t *testing.T) {
1010
firmwareSize := int64(25665 * 2)
1111
bar := formatStateData("fetch", "25665", firmwareSize, false)
12-
assert.Equal(t, "[========== ] 50.00% (firmware size: 51330 bytes)", bar)
12+
assert.Equal(t, "[========== ] 50% (firmware size: 51330 bytes)", bar)
1313
}
1414

1515
func TestProgressBar_ifFlashState_goTo100Pct(t *testing.T) {
1616
firmwareSize := int64(25665 * 2)
1717
bar := formatStateData("fetch", "25665", firmwareSize, true) // If in flash status, go to 100%
18-
assert.Equal(t, "[====================] 100.00% (firmware size: 51330 bytes)", bar)
18+
assert.Equal(t, "[====================] 100% (firmware size: 51330 bytes)", bar)
1919
}

0 commit comments

Comments
 (0)