mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958
This commit is contained in:
parent
3d3b2df07a
commit
333cba07f4
1 changed files with 32 additions and 0 deletions
|
|
@ -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)) + "%"}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue