master
Evan Chen 2022-01-10 09:53:34 +08:00
parent 13d3e85317
commit f579ad33e7
1 changed files with 2 additions and 2 deletions

View File

@ -44,8 +44,8 @@ func (e *Event) BeforeSave(tx *gorm.DB) (err error) {
(? >= "start" and ? <= "end" ) (? >= "start" and ? <= "end" )
or or
(? >= "start" and ? <= "end" ) (? >= "start" and ? <= "end" )
and calendar_id = ? limit 1`, and calendar_id = ? and id <> ? limit 1`,
e.End, e.End, e.Start, e.Start, e.CalendarID).Scan(&cnt) e.End, e.End, e.Start, e.Start, e.CalendarID, e.ID).Scan(&cnt)
if cnt != "" { if cnt != "" {
return errors.New(500, "event collide with existing") return errors.New(500, "event collide with existing")
} }