Sorting events in vehicles
This commit is contained in:
parent
ef90973ef8
commit
9c44a26201
@ -1080,7 +1080,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 94;
|
||||
CURRENT_PROJECT_VERSION = 95;
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
@ -1105,7 +1105,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 94;
|
||||
CURRENT_PROJECT_VERSION = 95;
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
|
||||
@ -259,7 +259,7 @@ public class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable
|
||||
}
|
||||
|
||||
if let eventsArray = try container.decodeIfPresent([VehicleEvent].self, forKey: .events) {
|
||||
self.events.append(objectsIn: eventsArray)
|
||||
self.events.append(objectsIn: eventsArray.sorted { $0.date > $1.date })
|
||||
}
|
||||
|
||||
if let osago = try container.decodeIfPresent([Osago].self, forKey: .osagoContracts) {
|
||||
@ -343,7 +343,7 @@ public class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable
|
||||
self.ownershipPeriods = ownerships
|
||||
|
||||
let events = List<VehicleEvent>()
|
||||
events.append(objectsIn: copy.events.map { $0.clone() })
|
||||
events.append(objectsIn: copy.events.map { $0.clone() }.sorted { $0.date > $1.date })
|
||||
self.events = events
|
||||
|
||||
let osago = List<Osago>()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user