fix: fixed and changed to footprint update by transactions

This commit is contained in:
Christoph Kluge
2024-10-22 14:37:22 +02:00
parent 82e28f26d7
commit 63b9e619a4
3 changed files with 40 additions and 27 deletions

View File

@@ -621,13 +621,12 @@ func (r *JobRepository) UpdateEnergy(
}
var rawFootprint []byte
if rawFootprint, err = json.Marshal(energyFootprint); err != nil {
log.Warnf("Error while marshaling energy footprint for job, DB ID '%v'", jobMeta.ID)
log.Warnf("Error while marshaling energy footprint for job INTO BYTES, DB ID '%v'", jobMeta.ID)
return stmt, err
}
return stmt.Set("energy_footprint", rawFootprint).Set("energy", (math.Round(totalEnergy*100) / 100)), nil
return stmt.Set("energy_footprint", string(rawFootprint)).Set("energy", (math.Round(totalEnergy*100) / 100)), nil
}
func (r *JobRepository) UpdateFootprint(
@@ -654,11 +653,10 @@ func (r *JobRepository) UpdateFootprint(
}
var rawFootprint []byte
if rawFootprint, err = json.Marshal(footprint); err != nil {
log.Warnf("Error while marshaling footprint for job, DB ID '%v'", jobMeta.ID)
log.Warnf("Error while marshaling footprint for job INTO BYTES, DB ID '%v'", jobMeta.ID)
return stmt, err
}
return stmt.Set("footprint", rawFootprint), nil
return stmt.Set("footprint", string(rawFootprint)), nil
}