Add measurement summary to list command
This commit is contained in:
@@ -27,9 +27,27 @@ func init() {
|
||||
log.WithError(err).Error("failed to list measurements")
|
||||
return err
|
||||
}
|
||||
|
||||
msmtSummary := output.MeasurementSummaryData{
|
||||
TotalCount: 0,
|
||||
AnomalyCount: 0,
|
||||
DataUsageUp: 0,
|
||||
DataUsageDown: 0,
|
||||
}
|
||||
for _, msmt := range measurements {
|
||||
// FIXME this logic should be adjusted for test groups that have many
|
||||
// measurements in them
|
||||
if msmtSummary.DataUsageUp == 0 {
|
||||
msmtSummary.DataUsageUp = msmt.DataUsageUp
|
||||
msmtSummary.DataUsageDown = msmt.DataUsageDown
|
||||
}
|
||||
if msmt.IsAnomaly.Bool == true {
|
||||
msmtSummary.AnomalyCount++
|
||||
}
|
||||
msmtSummary.TotalCount++
|
||||
output.MeasurementItem(msmt)
|
||||
}
|
||||
output.MeasurementSummary(msmtSummary)
|
||||
} else {
|
||||
doneResults, incompleteResults, err := database.ListResults(ctx.DB)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user