status: user-visible replication step number should start at 1

fixes https://github.com/zrepl/zrepl/issues/538
This commit is contained in:
Christian Schwarz 2021-11-21 15:15:23 +01:00
parent ac147b5a6f
commit b00b61e967

View File

@ -227,9 +227,13 @@ func printFilesystemStatus(t *stringbuilder.B, rep *report.FilesystemReport, max
sizeEstimationImpreciseNotice = " (step lacks size estimation)" 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", status := fmt.Sprintf("%s (step %d/%d, %s/%s)%s",
strings.ToUpper(string(rep.State)), strings.ToUpper(string(rep.State)),
rep.CurrentStep, len(rep.Steps), userVisisbleCurrentStep, userVisibleTotalSteps,
ByteCountBinaryUint(replicated), ByteCountBinaryUint(expected), ByteCountBinaryUint(replicated), ByteCountBinaryUint(expected),
sizeEstimationImpreciseNotice, sizeEstimationImpreciseNotice,
) )