From 0ea5fd2af47c8b7caa060b45682260be74927736 Mon Sep 17 00:00:00 2001 From: bohung Date: Wed, 16 Dec 2020 18:21:24 +0800 Subject: [PATCH] Fix calendar missing bug. --- app/models/concerns/venue_link_file.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/venue_link_file.rb b/app/models/concerns/venue_link_file.rb index b970443..54ba78c 100644 --- a/app/models/concerns/venue_link_file.rb +++ b/app/models/concerns/venue_link_file.rb @@ -65,8 +65,11 @@ module VenueLinkFile if key_id.nil? self.calendar_dict[key] = Event.create(update_dict.merge(create_user_id: current_user_id)).id else - calendar = Event.find(key_id) - calendar.update_attributes(update_dict) + calendar = Event.find(key_id) rescue nil + calendar.update_attributes(update_dict) if !calendar.nil? + if calendar.nil? + self.calendar_dict[key] = Event.create(update_dict.merge(create_user_id: current_user_id)).id + end end end end