Fix bug in result listing

This commit is contained in:
Arturo Filastò 2018-09-10 16:56:32 +02:00
commit e5c508a94c
4 changed files with 17 additions and 11 deletions

View file

@ -80,6 +80,7 @@ func GetMeasurementCounts(sess sqlbuilder.Database, resultID int64) (uint64, uin
return totalCount, anmlyCount, err
}
log.Debugf("counts: %d, %d, %d", resultID, totalCount, anmlyCount)
return totalCount, anmlyCount, err
}
@ -90,8 +91,9 @@ func ListResults(sess sqlbuilder.Database) ([]ResultNetwork, []ResultNetwork, er
req := sess.Select(
"networks.id AS network_id",
db.Raw("results.*"),
"results.id AS result_id",
db.Raw("networks.*"),
db.Raw("results.*"),
).From("results").
Join("networks").On("results.network_id = networks.id").
OrderBy("results.start_time")

View file

@ -13,8 +13,10 @@ import (
// ResultNetwork is used to represent the structure made from the JOIN
// between the results and networks tables.
type ResultNetwork struct {
Result `db:",inline"`
Network `db:",inline"`
Result `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