File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Modules/Sources/Yosemite/Model/Storage Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,12 @@ extension PersistedProduct {
4444 }
4545
4646 func toPOSProduct( db: GRDBDatabaseConnection ) throws -> POSProduct {
47- let images = try db. read { db in
48- return try request ( for: PersistedProduct . images) . fetchAll ( db)
49- }
50- let attributes = try db. read { db in
51- return try request ( for: PersistedProduct . attributes) . fetchAll ( db)
47+ let ( images, attributes) = try db. read { db in
48+ let images = try request ( for: PersistedProduct . images) . fetchAll ( db)
49+ let attributes = try request ( for: PersistedProduct . attributes) . fetchAll ( db)
50+ return ( images, attributes)
5251 }
52+
5353 return toPOSProduct (
5454 images: images. map { $0. toProductImage ( ) } ,
5555 attributes: attributes. map { $0. toProductAttribute ( siteID: siteID) }
@@ -96,7 +96,7 @@ extension PersistedProductAttribute {
9696 func toProductAttribute( siteID: Int64 ) -> ProductAttribute {
9797 return ProductAttribute (
9898 siteID: siteID,
99- attributeID: 0 ,
99+ attributeID: id ?? 0 ,
100100 name: name,
101101 position: Int ( position) ,
102102 visible: visible,
Original file line number Diff line number Diff line change @@ -38,12 +38,12 @@ extension PersistedProductVariation {
3838 }
3939
4040 func toPOSProductVariation( db: GRDBDatabaseConnection ) throws -> POSProductVariation {
41- let image = try db. read { db in
42- return try request ( for: PersistedProductVariation . image) . fetchOne ( db)
43- }
44- let attributes = try db. read { db in
45- return try request ( for: PersistedProductVariation . attributes) . fetchAll ( db)
41+ let ( image, attributes) = try db. read { db in
42+ let image = try request ( for: PersistedProductVariation . image) . fetchOne ( db)
43+ let attributes = try request ( for: PersistedProductVariation . attributes) . fetchAll ( db)
44+ return ( image, attributes)
4645 }
46+
4747 return toPOSProductVariation (
4848 attributes: attributes. map { $0. toProductVariationAttribute ( ) } ,
4949 image: image? . toProductImage ( )
You can’t perform that action at this time.
0 commit comments