mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Fix a but in add results endpoint, add model and result as optional action params
This commit is contained in:
parent
0f0e8872b9
commit
efd24023bc
2 changed files with 13 additions and 2 deletions
|
@ -46,6 +46,8 @@ type Action struct {
|
||||||
Act string `json:"action"`
|
Act string `json:"action"`
|
||||||
When int64 `json:"when"`
|
When int64 `json:"when"`
|
||||||
Parameters json.RawMessage `json:"parameters,omitempty"`
|
Parameters json.RawMessage `json:"parameters,omitempty"`
|
||||||
|
Model json.RawMessage `json:"model,omitempty"`
|
||||||
|
Results json.RawMessage `json:"results,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ICStatus struct {
|
type ICStatus struct {
|
||||||
|
|
|
@ -69,7 +69,12 @@ func (r *addResultRequest) createResult() Result {
|
||||||
|
|
||||||
s.Description = r.Result.Description
|
s.Description = r.Result.Description
|
||||||
s.ConfigSnapshots = r.Result.ConfigSnapshots
|
s.ConfigSnapshots = r.Result.ConfigSnapshots
|
||||||
|
if r.Result.ResultFileIDs == nil {
|
||||||
|
s.ResultFileIDs = []int64{}
|
||||||
|
} else {
|
||||||
s.ResultFileIDs = r.Result.ResultFileIDs
|
s.ResultFileIDs = r.Result.ResultFileIDs
|
||||||
|
}
|
||||||
|
|
||||||
s.ScenarioID = r.Result.ScenarioID
|
s.ScenarioID = r.Result.ScenarioID
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
@ -80,7 +85,11 @@ func (r *updateResultRequest) updatedResult(oldResult Result) Result {
|
||||||
s := oldResult
|
s := oldResult
|
||||||
|
|
||||||
s.Result.Description = r.Result.Description
|
s.Result.Description = r.Result.Description
|
||||||
|
if r.Result.ResultFileIDs == nil {
|
||||||
|
s.ResultFileIDs = []int64{}
|
||||||
|
} else {
|
||||||
s.ResultFileIDs = r.Result.ResultFileIDs
|
s.ResultFileIDs = r.Result.ResultFileIDs
|
||||||
|
}
|
||||||
|
|
||||||
// only update snapshots if not empty
|
// only update snapshots if not empty
|
||||||
var emptyJson postgres.Jsonb
|
var emptyJson postgres.Jsonb
|
||||||
|
|
Loading…
Add table
Reference in a new issue