mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Add Default fill specific time switch to database date field https://github.com/siyuan-note/siyuan/issues/12089#issuecomment-3353276813
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
9483a31b25
commit
6b220a753a
1 changed files with 15 additions and 5 deletions
|
|
@ -2206,16 +2206,26 @@ func setAttrViewColDateFillSpecificTime(operation *Operation) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
keyID := operation.ID
|
keyID := operation.ID
|
||||||
key, _ := attrView.GetKey(keyID)
|
dateValues, _ := attrView.GetKeyValues(keyID)
|
||||||
if nil == key || av.KeyTypeDate != key.Type {
|
if nil == dateValues || av.KeyTypeDate != dateValues.Key.Type {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == key.Date {
|
if nil == dateValues.Key.Date {
|
||||||
key.Date = &av.Date{}
|
dateValues.Key.Date = &av.Date{}
|
||||||
|
}
|
||||||
|
|
||||||
|
dateValues.Key.Date.FillSpecificTime = operation.Data.(bool)
|
||||||
|
for _, v := range dateValues.Values {
|
||||||
|
if !v.IsEmpty() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if nil == v.Date {
|
||||||
|
v.Date = &av.ValueDate{}
|
||||||
|
}
|
||||||
|
v.Date.IsNotTime = !dateValues.Key.Date.FillSpecificTime
|
||||||
}
|
}
|
||||||
|
|
||||||
key.Date.FillSpecificTime = operation.Data.(bool)
|
|
||||||
err = av.SaveAttributeView(attrView)
|
err = av.SaveAttributeView(attrView)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue