From f5756cd6508852d54a7cd06388fe8a057cc5dd94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Mu=CC=88ller?= Date: Wed, 10 Feb 2021 22:20:10 +0100 Subject: [PATCH] :bug: Fixed bug where the app would create new RaPlaEvent objects instead of updating the existing ones --- DHBW-Service/Utility/RaPlaFetcher.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DHBW-Service/Utility/RaPlaFetcher.swift b/DHBW-Service/Utility/RaPlaFetcher.swift index d3d563b..90d2ef2 100644 --- a/DHBW-Service/Utility/RaPlaFetcher.swift +++ b/DHBW-Service/Utility/RaPlaFetcher.swift @@ -156,10 +156,10 @@ class RaPlaFetcher { // Save the given iCalEvent objects to CoreData // Updates the events if they already exist and deletes old (/invalid) ones private class func saveToCoreData(eventObjects: [iCalEvent]) -> Bool{ - let existingEvents: [RaPlaEvent] = [] //RaPlaEvent.getAll() + let existingEvents: [RaPlaEvent] = RaPlaEvent.getAll() var existingEventsDict: [String:RaPlaEvent] = [:] for event in existingEvents { - existingEventsDict[event.value(forKey: "uid") as! String] = event + existingEventsDict[event.uid!] = event } let newEventUIDs = eventObjects.map{$0.uid}