From 94cac32d1bb2d255f8c708174c380d83b8fc3a69 Mon Sep 17 00:00:00 2001 From: Jeff Ortel Date: Fri, 15 Dec 2023 13:31:39 -0800 Subject: [PATCH] checkpoint Signed-off-by: Jeff Ortel --- api/task.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/api/task.go b/api/task.go index 571f7601e..6ce5c3dc1 100644 --- a/api/task.go +++ b/api/task.go @@ -14,6 +14,7 @@ import ( "strconv" "strings" "time" + "k8s.io/utils/strings/slices" ) // @@ -642,9 +643,11 @@ func (r *Task) injectFiles(db *gorm.DB) (err error) { content, "> "+s) } + snipA := slices.Clone(r.Activity[:ref.Index]) + snipB := slices.Clone(r.Activity[ref.Index:]) r.Activity = append( - append(r.Activity[:ref.Index], content...), - r.Activity[ref.Index:]...) + append(snipA, content...), + snipB...) } return } @@ -717,6 +720,9 @@ func (r *TaskReport) Model() (m *model.TaskReport) { // // Attachment task report attached file ref. type Attachment struct { - Ref `yaml:",inline"` + // Ref references an attached File. + Ref `yaml:",inline"` + // Index 1-based association with an activity entry. + // Zero(0) indicates not associated. Index int `json:"index,omitempty" yaml:",omitempty"` }