From c459724114abbc1b03c6d7ab23c1f1b373759127 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Fri, 30 Aug 2024 13:50:49 +0200 Subject: [PATCH] Resolve build errors --- internal/importer/handleImport.go | 10 +++++++++- internal/importer/initDB.go | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/importer/handleImport.go b/internal/importer/handleImport.go index c4d55ab..35403f6 100644 --- a/internal/importer/handleImport.go +++ b/internal/importer/handleImport.go @@ -77,8 +77,16 @@ func HandleImportFlag(flag string) error { job.Footprint = make(map[string]float64) for _, fp := range sc.Footprint { - job.Footprint[fp] = repository.LoadJobStat(&job, fp) + statType := "avg" + + if i, err := archive.MetricIndex(sc.MetricConfig, fp); err != nil { + statType = sc.MetricConfig[i].Footprint + } + + name := fmt.Sprintf("%s_%s", fp, statType) + job.Footprint[fp] = repository.LoadJobStat(&job, name, statType) } + job.RawFootprint, err = json.Marshal(job.Footprint) if err != nil { log.Warn("Error while marshaling job footprint") diff --git a/internal/importer/initDB.go b/internal/importer/initDB.go index 4b9abab..fe49e94 100644 --- a/internal/importer/initDB.go +++ b/internal/importer/initDB.go @@ -68,7 +68,15 @@ func InitDB() error { job.Footprint = make(map[string]float64) for _, fp := range sc.Footprint { - job.Footprint[fp] = repository.LoadJobStat(jobMeta, fp) + statType := "avg" + + if i, err := archive.MetricIndex(sc.MetricConfig, fp); err != nil { + statType = sc.MetricConfig[i].Footprint + } + + name := fmt.Sprintf("%s_%s", fp, statType) + + job.Footprint[fp] = repository.LoadJobStat(jobMeta, name, statType) } job.RawFootprint, err = json.Marshal(job.Footprint)