Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958

Daniel333cba07f4c2
diff --git a/kernel/av/value.go b/kernel/av/value.go
index 46ab870f94..64b724dffa 100644
--- a/kernel/av/value.go
+++ b/kernel/av/value.go
@@ -597,5 +597,37 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc) {
}
}
r.Contents = []string{strconv.FormatFloat(max-min, 'f', -1, 64)}
+ case CalcOperatorChecked:
+ countChecked := 0
+ for _, v := range r.Contents {
+ if "√" == v {
+ countChecked++
+ }
+ }
+ r.Contents = []string{strconv.Itoa(countChecked)}
+ case CalcOperatorUnchecked:
+ countUnchecked := 0
+ for _, v := range r.Contents {
+ if "√" != v {
+ countUnchecked++
+ }
+ }
+ r.Contents = []string{strconv.Itoa(countUnchecked)}
+ case CalcOperatorPercentChecked:
+ countChecked := 0
+ for _, v := range r.Contents {
+ if "√" == v {
+ countChecked++
+ }
+ }
+ r.Contents = []string{strconv.Itoa(countChecked*100/len(r.Contents)) + "%"}
+ case CalcOperatorPercentUnchecked:
+ countUnchecked := 0
+ for _, v := range r.Contents {
+ if "√" != v {
+ countUnchecked++
+ }
+ }
+ r.Contents = []string{strconv.Itoa(countUnchecked*100/len(r.Contents)) + "%"}
}
}