@@ -552,7 +552,6 @@ enum State: Int, CustomStringConvertible {
552552 @discardableResult
553553 @objc public static func create( feature: [ AnyHashable : Any ] , context: NSManagedObjectContext ) -> Observation ? {
554554 var newObservation : Observation ? = nil ;
555- let eventId = Server . currentEventId ( ) ;
556555 let remoteId = Observation . idFromJson ( json: feature) ;
557556
558557 let state = Observation . stateFromJson ( json: feature) ;
@@ -658,13 +657,11 @@ enum State: Int, CustomStringConvertible {
658657 }
659658 }
660659 }
661- existingObservation. eventId = eventId;
662660 }
663661 } else {
664662 if state != . Archive {
665663 // if the observation doesn't exist, insert it
666664 if let observation = Observation . mr_createEntity ( in: context) {
667- observation. eventId = eventId;
668665 observation. populate ( json: feature) ;
669666 if let userId = observation. userId {
670667 if let user = User . mr_findFirst ( byAttribute: UserKey . remoteId. key, withValue: userId, in: context) {
@@ -756,6 +753,7 @@ enum State: Int, CustomStringConvertible {
756753
757754 @discardableResult
758755 @objc public func populate( json: [ AnyHashable : Any ] ) -> Observation {
756+ self . eventId = json [ ObservationKey . eventId. key] as? NSNumber
759757 self . remoteId = Observation . idFromJson ( json: json) ;
760758 self . userId = json [ ObservationKey . userId. key] as? String
761759 self . deviceId = json [ ObservationKey . deviceId. key] as? String
0 commit comments