Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <[email protected]>
  • Loading branch information
jortel committed Dec 13, 2023
1 parent d58aa0f commit 2fa85a7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions api/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 2fa85a7

Please sign in to comment.