mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
BUGFIX: double entries for almanachse
This commit is contained in:
26
migrations/seed/entry_comments.go
Normal file
26
migrations/seed/entry_comments.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package seed
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/musenalm/dbmodels"
|
||||
)
|
||||
|
||||
func appendEntryComment(entry *dbmodels.Entry, note string) {
|
||||
note = strings.TrimSpace(note)
|
||||
if note == "" {
|
||||
return
|
||||
}
|
||||
|
||||
current := strings.TrimSpace(entry.Comment())
|
||||
if current == "" {
|
||||
entry.SetComment(note)
|
||||
return
|
||||
}
|
||||
|
||||
if strings.Contains(current, note) {
|
||||
return
|
||||
}
|
||||
|
||||
entry.SetComment(current + "\n" + note)
|
||||
}
|
||||
Reference in New Issue
Block a user