Fix bug in result listing
This commit is contained in:
parent
e0c0acffeb
commit
e5c508a94c
|
@ -42,7 +42,7 @@ func init() {
|
||||||
}
|
}
|
||||||
for idx, result := range incompleteResults {
|
for idx, result := range incompleteResults {
|
||||||
output.ResultItem(output.ResultItemData{
|
output.ResultItem(output.ResultItemData{
|
||||||
ID: result.Result.ID,
|
ID: result.ResultID,
|
||||||
Index: idx,
|
Index: idx,
|
||||||
TotalCount: len(incompleteResults),
|
TotalCount: len(incompleteResults),
|
||||||
Name: result.TestGroupName,
|
Name: result.TestGroupName,
|
||||||
|
@ -63,16 +63,16 @@ func init() {
|
||||||
netCount := make(map[uint]int)
|
netCount := make(map[uint]int)
|
||||||
output.SectionTitle("Results")
|
output.SectionTitle("Results")
|
||||||
for idx, result := range doneResults {
|
for idx, result := range doneResults {
|
||||||
totalCount, anmlyCount, err := database.GetMeasurementCounts(ctx.DB, result.Result.ID)
|
totalCount, anmlyCount, err := database.GetMeasurementCounts(ctx.DB, result.ResultID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("failed to list measurement counts")
|
log.WithError(err).Error("failed to list measurement counts")
|
||||||
}
|
}
|
||||||
testKeys, err := database.GetResultTestKeys(ctx.DB, result.Result.ID)
|
testKeys, err := database.GetResultTestKeys(ctx.DB, result.ResultID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("failed to get testKeys")
|
log.WithError(err).Error("failed to get testKeys")
|
||||||
}
|
}
|
||||||
output.ResultItem(output.ResultItemData{
|
output.ResultItem(output.ResultItemData{
|
||||||
ID: result.Result.ID,
|
ID: result.ResultID,
|
||||||
Index: idx,
|
Index: idx,
|
||||||
TotalCount: len(doneResults),
|
TotalCount: len(doneResults),
|
||||||
Name: result.TestGroupName,
|
Name: result.TestGroupName,
|
||||||
|
|
|
@ -80,6 +80,7 @@ func GetMeasurementCounts(sess sqlbuilder.Database, resultID int64) (uint64, uin
|
||||||
return totalCount, anmlyCount, err
|
return totalCount, anmlyCount, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("counts: %d, %d, %d", resultID, totalCount, anmlyCount)
|
||||||
return totalCount, anmlyCount, err
|
return totalCount, anmlyCount, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +91,9 @@ func ListResults(sess sqlbuilder.Database) ([]ResultNetwork, []ResultNetwork, er
|
||||||
|
|
||||||
req := sess.Select(
|
req := sess.Select(
|
||||||
"networks.id AS network_id",
|
"networks.id AS network_id",
|
||||||
db.Raw("results.*"),
|
"results.id AS result_id",
|
||||||
db.Raw("networks.*"),
|
db.Raw("networks.*"),
|
||||||
|
db.Raw("results.*"),
|
||||||
).From("results").
|
).From("results").
|
||||||
Join("networks").On("results.network_id = networks.id").
|
Join("networks").On("results.network_id = networks.id").
|
||||||
OrderBy("results.start_time")
|
OrderBy("results.start_time")
|
||||||
|
|
|
@ -13,8 +13,10 @@ import (
|
||||||
// ResultNetwork is used to represent the structure made from the JOIN
|
// ResultNetwork is used to represent the structure made from the JOIN
|
||||||
// between the results and networks tables.
|
// between the results and networks tables.
|
||||||
type ResultNetwork struct {
|
type ResultNetwork struct {
|
||||||
Result `db:",inline"`
|
Result `db:",inline"`
|
||||||
Network `db:",inline"`
|
ResultID int64 `db:"result_id"`
|
||||||
|
Network `db:",inline"`
|
||||||
|
NetworkID int64 `db:"network_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MeasurementURLNetwork is used for the JOIN between Measurement and URL
|
// MeasurementURLNetwork is used for the JOIN between Measurement and URL
|
||||||
|
|
|
@ -105,11 +105,13 @@ func logTable(w io.Writer, f log.Fields) error {
|
||||||
func (h *Handler) TypedLog(t string, e *log.Entry) error {
|
func (h *Handler) TypedLog(t string, e *log.Entry) error {
|
||||||
switch t {
|
switch t {
|
||||||
case "progress":
|
case "progress":
|
||||||
var err error
|
perc := e.Fields.Get("percentage").(float64) * 100
|
||||||
s := fmt.Sprintf("%.2f%%: %-25s", e.Fields.Get("percentage").(float64)*100, e.Message)
|
s := fmt.Sprintf(" %s\n %-25s",
|
||||||
fmt.Fprintf(h.Writer, s)
|
bold.Sprintf("%.2f%%", perc),
|
||||||
|
bold.Sprint(e.Message))
|
||||||
|
fmt.Fprint(h.Writer, s)
|
||||||
fmt.Fprintln(h.Writer)
|
fmt.Fprintln(h.Writer)
|
||||||
return err
|
return nil
|
||||||
case "table":
|
case "table":
|
||||||
return logTable(h.Writer, e.Fields)
|
return logTable(h.Writer, e.Fields)
|
||||||
case "result_item":
|
case "result_item":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user