This commit is contained in:
Daniel 2025-07-28 23:58:34 +08:00
parent 05e495406d
commit 1812e84219
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1588,7 +1588,7 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
items = append(items, item)
}
groupKey, _ := attrView.GetKey(group.Field)
groupKey := view.GetGroupKey(attrView)
if nil == groupKey {
return
}
@ -1611,10 +1611,20 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
return items[i].GetValue(group.Field).Number.Content < items[j].GetValue(group.Field).Number.Content
})
case av.GroupMethodDateDay, av.GroupMethodDateWeek, av.GroupMethodDateMonth, av.GroupMethodDateYear, av.GroupMethodDateRelative:
if av.KeyTypeCreated == groupKey.Type {
sort.SliceStable(items, func(i, j int) bool {
return items[i].GetValue(group.Field).Created.Content < items[j].GetValue(group.Field).Created.Content
})
} else if av.KeyTypeUpdated == groupKey.Type {
sort.SliceStable(items, func(i, j int) bool {
return items[i].GetValue(group.Field).Updated.Content < items[j].GetValue(group.Field).Updated.Content
})
} else if av.KeyTypeDate == groupKey.Type {
sort.SliceStable(items, func(i, j int) bool {
return items[i].GetValue(group.Field).Date.Content < items[j].GetValue(group.Field).Date.Content
})
}
}
var groupName string
groupItemsMap := map[string][]av.Item{}