From 7ce8e6577aa3bc29b677f1e43c429ad830d257d3 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Mon, 10 Jan 2022 09:55:49 +0800 Subject: [PATCH] update --- calendar/event.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/calendar/event.go b/calendar/event.go index 760fa22..f6e2801 100644 --- a/calendar/event.go +++ b/calendar/event.go @@ -41,9 +41,11 @@ func (e *Event) BeforeSave(tx *gorm.DB) (err error) { // test for collide cnt := "" db.Raw(`select id from events e where - (? >= "start" and ? <= "end" ) - or - (? >= "start" and ? <= "end" ) + ( + (? >= "start" and ? <= "end" ) + or + (? >= "start" and ? <= "end" ) + ) and calendar_id = ? and id <> ? limit 1`, e.End, e.End, e.Start, e.Start, e.CalendarID, e.ID).Scan(&cnt) if cnt != "" {