diff --git a/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift b/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift index fd5c7e689d1..ff11c41c5ac 100644 --- a/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift +++ b/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift @@ -683,7 +683,7 @@ extension Networking.OrderGiftCard { public func copy( giftCardID: CopiableProp = .copy, code: CopiableProp = .copy, - amount: CopiableProp = .copy + amount: CopiableProp = .copy ) -> Networking.OrderGiftCard { let giftCardID = giftCardID ?? self.giftCardID let code = code ?? self.code diff --git a/Networking/Networking/Model/OrderGiftCard.swift b/Networking/Networking/Model/OrderGiftCard.swift index 2dcc347b1b6..e60da4a1ea7 100644 --- a/Networking/Networking/Model/OrderGiftCard.swift +++ b/Networking/Networking/Model/OrderGiftCard.swift @@ -15,11 +15,11 @@ public struct OrderGiftCard: Codable, Equatable, GeneratedFakeable, GeneratedCop /// Amount applied to the order /// - public let amount: Int64 + public let amount: Double /// OrderGiftCard struct initializer. /// - public init(giftCardID: Int64, code: String, amount: Int64) { + public init(giftCardID: Int64, code: String, amount: Double) { self.giftCardID = giftCardID self.code = code self.amount = amount diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index a58d56fb9e9..9bd79505c2a 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -6,6 +6,8 @@ - [Internal] Orders: Composite components (within a composite product) are now indented, to show their relationship to the parent composite product. [https://github.com/woocommerce/woocommerce-ios/pull/9780] - [*] Add Products: A new view is display to celebrate when the first product is created in a store. [https://github.com/woocommerce/woocommerce-ios/pull/9790] - [*] Product form: a share action is shown in the navigation bar if the product can be shared and no more than one action is displayed, in addition to the more menu > Share. [https://github.com/woocommerce/woocommerce-ios/pull/9789] +- [*] Orders: Fixes a bug where the Orders list would not load if an order had a non-integer gift card amount applied to the order (with the Gift Cards extension). [https://github.com/woocommerce/woocommerce-ios/pull/9795] + - [*] My Store: A new button to share the current store is added on the top right of the screen. [https://github.com/woocommerce/woocommerce-ios/pull/9796] 13.7 diff --git a/Storage/Storage.xcodeproj/project.pbxproj b/Storage/Storage.xcodeproj/project.pbxproj index cea16aa5a1e..52327356219 100644 --- a/Storage/Storage.xcodeproj/project.pbxproj +++ b/Storage/Storage.xcodeproj/project.pbxproj @@ -463,6 +463,7 @@ CCF3209E2927EBEE002114B1 /* Model 78.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 78.xcdatamodel"; sourceTree = ""; }; CE12FBE22220515600C59248 /* WooCommerceModelV9toV10.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; path = WooCommerceModelV9toV10.xcmappingmodel; sourceTree = ""; }; CE13681229FA8E6500EBF43C /* Model 86.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 86.xcdatamodel"; sourceTree = ""; }; + CE1999302A1C22B20093F863 /* Model 88.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 88.xcdatamodel"; sourceTree = ""; }; CE3B7AD02225E62C0050FE4B /* OrderStatus+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrderStatus+CoreDataClass.swift"; sourceTree = ""; }; CE3B7AD12225E62C0050FE4B /* OrderStatus+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrderStatus+CoreDataProperties.swift"; sourceTree = ""; }; CE43A8FB229F498D00A4FF29 /* ProductDownload+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProductDownload+CoreDataClass.swift"; sourceTree = ""; }; @@ -1869,6 +1870,7 @@ DEC51AA4275B41BE009F3DF4 /* WooCommerce.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + CE1999302A1C22B20093F863 /* Model 88.xcdatamodel */, CE831FE12A14F6C800E8BEFB /* Model 87.xcdatamodel */, CE13681229FA8E6500EBF43C /* Model 86.xcdatamodel */, CEE9188229F7E60C004B23FF /* Model 85.xcdatamodel */, @@ -1957,7 +1959,7 @@ DEC51ADE275B41BE009F3DF4 /* Model 47.xcdatamodel */, DEC51ADF275B41BE009F3DF4 /* Model 19.xcdatamodel */, ); - currentVersion = CE831FE12A14F6C800E8BEFB /* Model 87.xcdatamodel */; + currentVersion = CE1999302A1C22B20093F863 /* Model 88.xcdatamodel */; path = WooCommerce.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; diff --git a/Storage/Storage/Model/MIGRATIONS.md b/Storage/Storage/Model/MIGRATIONS.md index 7730188006f..a40d375a87d 100644 --- a/Storage/Storage/Model/MIGRATIONS.md +++ b/Storage/Storage/Model/MIGRATIONS.md @@ -2,6 +2,10 @@ This file documents changes in the WCiOS Storage data model. Please explain any changes to the data model as well as any custom migrations. +## Model 88 (Release 13.8.0.0) +- @rachelmcr 2023-05-22 + - Update `amount` attribute on `OrderGiftCard` entity to `Double` type. + ## Model 87 (Release 13.7.0.0) - @rachelmcr 2023-05-17 - Added `parent` attribute to `OrderItem` entity. diff --git a/Storage/Storage/Model/OrderGiftCard+CoreDataProperties.swift b/Storage/Storage/Model/OrderGiftCard+CoreDataProperties.swift index 9ea673aad22..d8b7594e3cf 100644 --- a/Storage/Storage/Model/OrderGiftCard+CoreDataProperties.swift +++ b/Storage/Storage/Model/OrderGiftCard+CoreDataProperties.swift @@ -10,7 +10,7 @@ extension OrderGiftCard { @NSManaged public var giftCardID: Int64 @NSManaged public var code: String? - @NSManaged public var amount: Int64 + @NSManaged public var amount: Double @NSManaged public var order: Order? } diff --git a/Storage/Storage/Model/WooCommerce.xcdatamodeld/.xccurrentversion b/Storage/Storage/Model/WooCommerce.xcdatamodeld/.xccurrentversion index 2abdbc6e748..efeff3447ad 100644 --- a/Storage/Storage/Model/WooCommerce.xcdatamodeld/.xccurrentversion +++ b/Storage/Storage/Model/WooCommerce.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - Model 87.xcdatamodel + Model 88.xcdatamodel diff --git a/Storage/Storage/Model/WooCommerce.xcdatamodeld/Model 88.xcdatamodel/contents b/Storage/Storage/Model/WooCommerce.xcdatamodeld/Model 88.xcdatamodel/contents new file mode 100644 index 00000000000..fb0569f0226 --- /dev/null +++ b/Storage/Storage/Model/WooCommerce.xcdatamodeld/Model 88.xcdatamodel/contents @@ -0,0 +1,900 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Storage/StorageTests/CoreData/MigrationTests.swift b/Storage/StorageTests/CoreData/MigrationTests.swift index 82fe7595a6c..0ae7ec2f917 100644 --- a/Storage/StorageTests/CoreData/MigrationTests.swift +++ b/Storage/StorageTests/CoreData/MigrationTests.swift @@ -1913,6 +1913,30 @@ final class MigrationTests: XCTestCase { // New value is set correctly for parent attribute. XCTAssertEqual(try XCTUnwrap(migratedOrderItem.value(forKey: "parent") as? Int64), parentID) } + + func test_migrating_from_87_to_88_updates_gift_card_amount_to_Double() throws { + // Given + let sourceContainer = try startPersistentContainer("Model 87") + let sourceContext = sourceContainer.viewContext + + let orderGiftCard = insertOrderGiftCard(to: sourceContext) + orderGiftCard.setValue(1, forKey: "amount") + try sourceContext.save() + + // Value for gift card amount is Int64. + XCTAssertEqual(try sourceContext.count(entityName: "OrderGiftCard"), 1) + XCTAssertEqual(try XCTUnwrap(orderGiftCard.value(forKey: "amount") as? Int64), 1) + + // When + let targetContainer = try migrate(sourceContainer, to: "Model 88") + + // Then + let targetContext = targetContainer.viewContext + let migratedOrderGiftCard = try XCTUnwrap(targetContext.first(entityName: "OrderGiftCard")) + + // Migrated value for gift card amount is Double. + XCTAssertEqual(try XCTUnwrap(migratedOrderGiftCard.value(forKey: "amount") as? Double), 1.0) + } } // MARK: - Persistent Store Setup and Migrations