From 2fa85a7e209ee45cd13c4db5202732c75d772683 Mon Sep 17 00:00:00 2001 From: Jeff Ortel Date: Wed, 13 Dec 2023 13:27:09 -0800 Subject: [PATCH] checkpoint Signed-off-by: Jeff Ortel --- api/task.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/task.go b/api/task.go index d31914ccd..dc1b0294d 100644 --- a/api/task.go +++ b/api/task.go @@ -610,17 +610,15 @@ func (r *Task) Model() (m *model.Task) { // // injectFiles inject files into the activity. func (r *Task) injectFiles(db *gorm.DB) (err error) { - injected := 0 sort.Slice( r.Files, func(i, j int) bool { - return r.Files[i].Index < r.Files[j].Index + return r.Files[i].Index > r.Files[j].Index }) for _, ref := range r.Files { if ref.Index == 0 { continue } - ref.Index += injected if ref.Index > len(r.Activity) { continue } @@ -643,7 +641,6 @@ func (r *Task) injectFiles(db *gorm.DB) (err error) { r.Activity = append( append(r.Activity[:ref.Index], content...), r.Activity[ref.Index:]...) - injected += len(content) } return }