Commit 68b65e12 by Demid Merzlyakov

Minutely: CoreData fixes.

parent a989dda1
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<relationship name="location" maxCount="1" deletionRule="Nullify" destinationEntity="CoreLocation" inverseName="minutely" inverseEntity="CoreLocation"/> <relationship name="location" maxCount="1" deletionRule="Nullify" destinationEntity="CoreLocation" inverseName="minutely" inverseEntity="CoreLocation"/>
</entity> </entity>
<entity name="CoreMinutelyItem" representedClassName="CoreMinutelyItem" syncable="YES"> <entity name="CoreMinutelyItem" representedClassName="CoreMinutelyItem" syncable="YES">
<attribute name="precipitation" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/> <attribute name="precipitation" attributeType="Binary"/>
<attribute name="pressure" attributeType="Binary"/> <attribute name="pressure" attributeType="Binary"/>
<attribute name="temp" attributeType="Binary"/> <attribute name="temp" attributeType="Binary"/>
<attribute name="time" attributeType="Date" usesScalarValueType="NO"/> <attribute name="time" attributeType="Date" usesScalarValueType="NO"/>
...@@ -146,10 +146,10 @@ ...@@ -146,10 +146,10 @@
<element name="CoreHealth" positionX="277.1640625" positionY="-156.77734375" width="128" height="103"/> <element name="CoreHealth" positionX="277.1640625" positionY="-156.77734375" width="128" height="103"/>
<element name="CoreHourlyWeather" positionX="279.15234375" positionY="-29.234375" width="128" height="253"/> <element name="CoreHourlyWeather" positionX="279.15234375" positionY="-29.234375" width="128" height="253"/>
<element name="CoreLocation" positionX="113.6640625" positionY="-337.08984375" width="128" height="329"/> <element name="CoreLocation" positionX="113.6640625" positionY="-337.08984375" width="128" height="329"/>
<element name="CoreMinutelyForecast" positionX="-90" positionY="-324" width="128" height="74"/>
<element name="CoreMinutelyItem" positionX="-81" positionY="-315" width="128" height="119"/>
<element name="CoreNotifications" positionX="-153.28125" positionY="-336.6484375" width="128" height="88"/> <element name="CoreNotifications" positionX="-153.28125" positionY="-336.6484375" width="128" height="88"/>
<element name="CoreNWSAlert" positionX="-315.77734375" positionY="-337.84375" width="128" height="208"/> <element name="CoreNWSAlert" positionX="-315.77734375" positionY="-337.84375" width="128" height="208"/>
<element name="CorePollutant" positionX="438.171875" positionY="-103.41015625" width="128" height="88"/> <element name="CorePollutant" positionX="438.171875" positionY="-103.41015625" width="128" height="88"/>
<element name="CoreMinutelyForecast" positionX="-90" positionY="-324" width="128" height="74"/>
<element name="CoreMinutelyItem" positionX="-81" positionY="-315" width="128" height="119"/>
</elements> </elements>
</model> </model>
\ No newline at end of file
...@@ -14,6 +14,9 @@ open class CoreMinutelyItem: _CoreMinutelyItem, CoreDataAppModelConvertable { ...@@ -14,6 +14,9 @@ open class CoreMinutelyItem: _CoreMinutelyItem, CoreDataAppModelConvertable {
guard let pressure: Pressure = try CoreDataUtils.measurement(from: self.pressure, in: self, attributeName: "pressure") else { guard let pressure: Pressure = try CoreDataUtils.measurement(from: self.pressure, in: self, attributeName: "pressure") else {
throw CoreDataError.LoadAttributeError(entity: self, attributeName: "pressure", value: self.pressure, nestedError: nil) throw CoreDataError.LoadAttributeError(entity: self, attributeName: "pressure", value: self.pressure, nestedError: nil)
} }
guard let precipitation: Rainfall = try CoreDataUtils.measurement(from: self.precipitation, in: self, attributeName: "precipitation") else {
throw CoreDataError.LoadAttributeError(entity: self, attributeName: "precipitation", value: self.precipitation, nestedError: nil)
}
return MinutelyItem(time: time, temp: temp, precipitation: precipitation, windSpeed: windSpeed, pressure: pressure) return MinutelyItem(time: time, temp: temp, precipitation: precipitation, windSpeed: windSpeed, pressure: pressure)
} }
...@@ -30,7 +33,7 @@ open class CoreMinutelyItem: _CoreMinutelyItem, CoreDataAppModelConvertable { ...@@ -30,7 +33,7 @@ open class CoreMinutelyItem: _CoreMinutelyItem, CoreDataAppModelConvertable {
self.init(managedObjectContext: context) self.init(managedObjectContext: context)
self.time = appModel.time self.time = appModel.time
self.precipitation = appModel.precipitation self.precipitation = try CoreDataUtils.measurementToData(appModel.precipitation, in: self, attributeName: "precipitation")
self.temp = try CoreDataUtils.measurementToData(appModel.temp, in: self, attributeName: "temp") self.temp = try CoreDataUtils.measurementToData(appModel.temp, in: self, attributeName: "temp")
self.windSpeed = try CoreDataUtils.measurementToData(appModel.windSpeed, in: self, attributeName: "windSpeed") self.windSpeed = try CoreDataUtils.measurementToData(appModel.windSpeed, in: self, attributeName: "windSpeed")
......
...@@ -47,7 +47,7 @@ open class _CoreMinutelyItem: NSManagedObject { ...@@ -47,7 +47,7 @@ open class _CoreMinutelyItem: NSManagedObject {
// MARK: - Properties // MARK: - Properties
@NSManaged open @NSManaged open
var precipitation: Double var precipitation: Data!
@NSManaged open @NSManaged open
var pressure: Data! var pressure: Data!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment