Skip to content

Commit

Permalink
🎨 Improve update database cell option #13439
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 12, 2024
1 parent 9166956 commit 0bcf137
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/model/attribute_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package model
import (
"bytes"
"fmt"
"math/rand"
"os"
"path/filepath"
"slices"
Expand Down Expand Up @@ -3112,7 +3113,11 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID string, valueDa
for _, valOpt := range val.MSelect {
if opt := key.GetOption(valOpt.Content); nil == opt {
// 不存在的选项新建保存
opt = &av.SelectOption{Name: valOpt.Content, Color: valOpt.Color}
color := valOpt.Color
if "" == color {
color = fmt.Sprintf("%d", 1+rand.Intn(15))
}
opt = &av.SelectOption{Name: valOpt.Content, Color: color}
key.Options = append(key.Options, opt)
} else {
// 已经存在的选项颜色需要保持不变
Expand Down

0 comments on commit 0bcf137

Please sign in to comment.