From b00b61e9677209790ec9a018036e24b8ae336d52 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 21 Nov 2021 15:15:23 +0100 Subject: [PATCH] status: user-visible replication step number should start at 1 fixes https://github.com/zrepl/zrepl/issues/538 --- client/status/viewmodel/render.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/status/viewmodel/render.go b/client/status/viewmodel/render.go index b2d1e81..293efc8 100644 --- a/client/status/viewmodel/render.go +++ b/client/status/viewmodel/render.go @@ -227,9 +227,13 @@ func printFilesystemStatus(t *stringbuilder.B, rep *report.FilesystemReport, max sizeEstimationImpreciseNotice = " (step lacks size estimation)" } + userVisisbleCurrentStep, userVisibleTotalSteps := rep.CurrentStep, len(rep.Steps) + if len(rep.Steps) > 0 { + userVisisbleCurrentStep = rep.CurrentStep + 1 // CurrentStep is an index that starts at 0 + } status := fmt.Sprintf("%s (step %d/%d, %s/%s)%s", strings.ToUpper(string(rep.State)), - rep.CurrentStep, len(rep.Steps), + userVisisbleCurrentStep, userVisibleTotalSteps, ByteCountBinaryUint(replicated), ByteCountBinaryUint(expected), sizeEstimationImpreciseNotice, )