An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
Daniel9d59e84d7692
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 826ef34092..83a0599011 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -143,7 +143,7 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error}view.Group = group- genGroup(view, attrView)+ genAttrViewViewGroups(view, attrView)return err}@@ -1351,7 +1351,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,if isGroupByDate(view) {updatedDate := time.UnixMilli(view.GroupUpdated).Format("2006-01-02")if time.Now().Format("2006-01-02") != updatedDate {- genGroup(view, attrView)+ genAttrViewViewGroups(view, attrView)}for _, groupView := range view.Groups {@@ -1395,7 +1395,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,return}-func genGroup(view *av.View, attrView *av.AttributeView) {+func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {if nil == view.Group {return}@@ -1413,6 +1413,18 @@ func genGroup(view *av.View, attrView *av.AttributeView) {return}+ // 如果是按日期分组,则需要记录每个分组视图的一些状态字段,以便后面重新计算分组后可以恢复这些状态+ type GroupState struct{ Folded, Hidden bool }+ groupStates := map[string]*GroupState{}+ if isGroupByDate(view) {+ for _, groupView := range view.Groups {+ groupStates[groupView.Name] = &GroupState{+ Folded: groupView.GroupFolded,+ Hidden: groupView.GroupHidden,+ }+ }+ }+var rangeStart, rangeEnd float64switch group.Method {case av.GroupMethodValue:@@ -1548,6 +1560,14 @@ func genGroup(view *av.View, attrView *av.AttributeView) {if isGroupByDate(view) {view.GroupUpdated = time.Now().UnixMilli()++ // 则恢复分组视图状态+ for _, groupView := range view.Groups {+ if state, ok := groupStates[groupView.Name]; ok {+ groupView.GroupFolded = state.Folded+ groupView.GroupHidden = state.Hidden+ }+ }}av.SaveAttributeView(attrView)