Download this file
| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "encoding/json" |
| 6 | "strconv" |
| 7 | |
| 8 | "amadan.net/oficina/equipo/internal/equipo/team" |
| 9 | "gorm.io/gorm" |
| 10 | ) |
| 11 | |
| 12 | func (e *Execution) deliverAnswerAt(ctx context.Context, tx *gorm.DB, a runnerAssignment, q RunnerRequest) error { |
| 13 | var answer team.AnswerResult |
| 14 | if q.Artifact == nil || json.Unmarshal(q.Artifact.Payload, &answer) != nil { |
| 15 | return ErrInvalid |
| 16 | } |
| 17 | if err := tx.Model(&Task{}).Where("id=?", a.TaskID).Select("Revision").Updates(map[string]any{"Revision": gorm.Expr("revision+1")}).Error; err != nil { |
| 18 | return err |
| 19 | } |
| 20 | return conversationAt(tx).DeliverAnswer(Actor{Address: a.Person}, a.TaskID, a.StepKey, strconv.FormatInt(int64(q.Handle.Attempt), 10), answer) |
| 21 | } |
| 22 | |