mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-02 02:40:15 +01:00
🎨 Candidate values of the database relation fields are no longer subject to view filtering https://github.com/siyuan-note/siyuan/issues/10411
This commit is contained in:
parent
bc6d6b17f7
commit
0dc8f1752d
2 changed files with 28 additions and 1 deletions
|
|
@ -305,6 +305,27 @@ func SaveAttributeView(av *AttributeView) (err error) {
|
|||
}
|
||||
|
||||
// 数据订正
|
||||
|
||||
// 值去重
|
||||
blockValues := av.GetBlockKeyValues()
|
||||
blockIDs := map[string]bool{}
|
||||
var duplicatedValueIDs []string
|
||||
for _, blockValue := range blockValues.Values {
|
||||
if !blockIDs[blockValue.BlockID] {
|
||||
blockIDs[blockValue.BlockID] = true
|
||||
} else {
|
||||
duplicatedValueIDs = append(duplicatedValueIDs, blockValue.ID)
|
||||
}
|
||||
}
|
||||
var tmp []*Value
|
||||
for _, blockValue := range blockValues.Values {
|
||||
if !gulu.Str.Contains(blockValue.ID, duplicatedValueIDs) {
|
||||
tmp = append(tmp, blockValue)
|
||||
}
|
||||
}
|
||||
blockValues.Values = tmp
|
||||
|
||||
// 视图值去重
|
||||
for _, view := range av.Views {
|
||||
if nil != view.Table {
|
||||
// 行去重
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue