fix(alerting): make sure xorm can reset execution_error

This commit is contained in:
bergquist
2016-08-18 17:25:32 +02:00
parent def4632f08
commit d3421c671c

View File

@@ -222,7 +222,11 @@ func SetAlertState(cmd *m.SetAlertStateCommand) error {
alert.State = cmd.State
alert.StateChanges += 1
alert.NewStateDate = time.Now()
alert.ExecutionError = cmd.Error
if cmd.Error == "" {
alert.ExecutionError = " " //without this space, xorm skips updating this field
} else {
alert.ExecutionError = cmd.Error
}
sess.Id(alert.Id).Update(&alert)
return nil