Skip to content

Commit fb76687

Browse files
committed
Update sort descriptors for customers
1 parent 5d7ed17 commit fb76687

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomerSection/CustomerSearchUICommand.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ final class CustomerSearchUICommand: SearchUICommand {
157157
let storageManager = ServiceLocator.storageManager
158158
let predicate = NSPredicate(format: "siteID == %lld", siteID)
159159
let newCustomerSelectorIsEnabled = featureFlagService.isFeatureFlagEnabled(.betterCustomerSelectionInOrder)
160-
let descriptor = newCustomerSelectorIsEnabled ?
161-
NSSortDescriptor(keyPath: \StorageCustomer.firstName, ascending: true) : NSSortDescriptor(keyPath: \StorageCustomer.customerID, ascending: false)
162-
return ResultsController<StorageCustomer>(storageManager: storageManager, matching: predicate, sortedBy: [descriptor])
160+
let descriptors = newCustomerSelectorIsEnabled ?
161+
[
162+
NSSortDescriptor(keyPath: \StorageCustomer.firstName, ascending: true),
163+
NSSortDescriptor(keyPath: \StorageCustomer.customerID, ascending: true)
164+
] : [NSSortDescriptor(keyPath: \StorageCustomer.customerID, ascending: false)]
165+
return ResultsController<StorageCustomer>(storageManager: storageManager, matching: predicate, sortedBy: descriptors)
163166
}
164167

165168
func createStarterViewController() -> UIViewController? {

0 commit comments

Comments
 (0)