Skip to content

Commit

Permalink
fix OrderedCollection, SortByUpdated
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejLach committed Sep 11, 2024
1 parent 72d288c commit 5f8fe29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion asvocab_base_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (oc OrderedCollection) Swap(i, j int) {

// SortByUpdated sorts OrderedCollection objects by Updated rather than Published date
func (oc OrderedCollection) SortByUpdated() {
sort.Slice(oc.OrderedItems, func(i, j int) bool {
sort.Slice(oc.OrderedItems.Target, func(i, j int) bool {
if len(oc.OrderedItems.Target) > 0 {
if oc.OrderedItems.Target[i].IsObject() && oc.OrderedItems.Target[j].IsObject() {
return oc.OrderedItems.Target[j].GetObject().Updated.Before(*oc.OrderedItems.Target[i].GetObject().Updated)
Expand Down

0 comments on commit 5f8fe29

Please sign in to comment.