Add support for generating the Measurement summary
To generate the result summary we need to refactor how the SummaryMap works
This commit is contained in:
parent
00859e87a6
commit
f5ff3ac87a
3 changed files with 56 additions and 4 deletions
|
|
@ -129,13 +129,19 @@ func (m *Measurement) WriteSummary(db *sqlx.DB, summary string) error {
|
|||
|
||||
// AddToResult adds a measurement to a result
|
||||
func (m *Measurement) AddToResult(db *sqlx.DB, result *Result) error {
|
||||
var err error
|
||||
|
||||
m.ResultID = result.ID
|
||||
finalPath := filepath.Join(result.MeasurementDir,
|
||||
filepath.Base(m.ReportFilePath))
|
||||
|
||||
err := os.Rename(m.ReportFilePath, finalPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "moving report file")
|
||||
// If the finalPath already exists, it means it has already been moved there.
|
||||
// This happens in multi input reports
|
||||
if _, err = os.Stat(finalPath); os.IsNotExist(err) {
|
||||
err = os.Rename(m.ReportFilePath, finalPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "moving report file")
|
||||
}
|
||||
}
|
||||
m.ReportFilePath = finalPath
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue