|
|
@ -166,7 +166,7 @@ func (r *itemRepository) Fetch(ctx context.Context, filter models.ItemFilter) ([ |
|
|
|
} |
|
|
|
|
|
|
|
sort.Slice(res, func(i, j int) bool { |
|
|
|
// Most recently acquired first
|
|
|
|
// Acquired time, descending
|
|
|
|
ati, atj := res[i].AcquiredTime, res[j].AcquiredTime |
|
|
|
if ati == nil && atj != nil { |
|
|
|
return true |
|
|
@ -178,7 +178,7 @@ func (r *itemRepository) Fetch(ctx context.Context, filter models.ItemFilter) ([ |
|
|
|
return ati.After(*atj) |
|
|
|
} |
|
|
|
|
|
|
|
// Most recently scheduled next
|
|
|
|
// Scheduled date, ascending
|
|
|
|
sdi, sdj := res[i].ScheduledDate, res[j].ScheduledDate |
|
|
|
if sdi != nil && sdj == nil { |
|
|
|
return true |
|
|
@ -186,11 +186,11 @@ func (r *itemRepository) Fetch(ctx context.Context, filter models.ItemFilter) ([ |
|
|
|
if sdi == nil && sdj != nil { |
|
|
|
return false |
|
|
|
} |
|
|
|
if sdi != nil && sdj != nil { |
|
|
|
if sdi != nil && sdj != nil && *sdi != *sdj { |
|
|
|
return sdi.Before(*sdj) |
|
|
|
} |
|
|
|
|
|
|
|
// Created last
|
|
|
|
// Created time, descending
|
|
|
|
return res[i].CreatedTime.After(res[j].CreatedTime) |
|
|
|
}) |
|
|
|
|
|
|
|