@@ -34,15 +34,6 @@ final class OrderDetailsResultsControllers {
34
34
///
35
35
private lazy var productVariationResultsController : ResultsController < StorageProductVariation > = getProductVariationResultsController ( )
36
36
37
- /// Fee lines Results Controller.
38
- ///
39
- private lazy var feeLinesResultsController : ResultsController < StorageOrderFeeLine > = {
40
- let predicate = NSPredicate ( format: " order.orderID == %ld " , order. orderID)
41
- let descriptor = NSSortDescriptor ( key: " feeID " , ascending: true )
42
-
43
- return ResultsController < StorageOrderFeeLine > ( storageManager: storageManager, matching: predicate, sortedBy: [ descriptor] )
44
- } ( )
45
-
46
37
/// Status Results Controller.
47
38
///
48
39
private lazy var statusResultsController : ResultsController < StorageOrderStatus > = {
@@ -63,17 +54,6 @@ final class OrderDetailsResultsControllers {
63
54
return ResultsController < StorageRefund > ( storageManager: storageManager, matching: predicate, sortedBy: [ descriptor] )
64
55
} ( )
65
56
66
- /// ShippingLabel Results Controller.
67
- ///
68
- private lazy var shippingLabelResultsController : ResultsController < StorageShippingLabel > = {
69
- let predicate = NSPredicate ( format: " siteID = %ld AND orderID = %ld " , order. siteID, order. orderID)
70
- let dateCreatedDescriptor = NSSortDescriptor ( keyPath: \StorageShippingLabel . dateCreated, ascending: false )
71
- let shippingLabelIDDescriptor = NSSortDescriptor ( keyPath: \StorageShippingLabel . shippingLabelID, ascending: false )
72
- return ResultsController < StorageShippingLabel > ( storageManager: storageManager,
73
- matching: predicate,
74
- sortedBy: [ dateCreatedDescriptor, shippingLabelIDDescriptor] )
75
- } ( )
76
-
77
57
/// AddOnGroup ResultsController.
78
58
///
79
59
private lazy var addOnGroupResultsController : ResultsController < StorageAddOnGroup > = {
@@ -128,7 +108,7 @@ final class OrderDetailsResultsControllers {
128
108
/// Shipping labels for an Order
129
109
///
130
110
var shippingLabels : [ ShippingLabel ] {
131
- return shippingLabelResultsController . fetchedObjects
111
+ return order . shippingLabels
132
112
}
133
113
134
114
/// Site's add-on groups.
@@ -142,7 +122,7 @@ final class OrderDetailsResultsControllers {
142
122
}
143
123
144
124
var feeLines : [ OrderFeeLine ] {
145
- return feeLinesResultsController . fetchedObjects
125
+ return order . fees
146
126
}
147
127
148
128
/// Shipping methods list
@@ -169,10 +149,8 @@ final class OrderDetailsResultsControllers {
169
149
configureProductResultsController ( onReload: onReload)
170
150
configureProductVariationResultsController ( onReload: onReload)
171
151
configureRefundResultsController ( onReload: onReload)
172
- configureShippingLabelResultsController ( onReload: onReload)
173
152
configureAddOnGroupResultsController ( onReload: onReload)
174
153
configureSitePluginsResultsController ( onReload: onReload)
175
- configureFeeLinesResultsController ( onReload: onReload)
176
154
configureShippingMethodsResultsController ( onReload: onReload)
177
155
}
178
156
@@ -286,24 +264,6 @@ private extension OrderDetailsResultsControllers {
286
264
}
287
265
}
288
266
289
- private func configureShippingLabelResultsController( onReload: @escaping ( ) -> Void ) {
290
- shippingLabelResultsController. onDidChangeContent = {
291
- onReload ( )
292
- }
293
-
294
- shippingLabelResultsController. onDidResetContent = { [ weak self] in
295
- guard let self = self else { return }
296
- self . refetchAllResultsControllers ( )
297
- onReload ( )
298
- }
299
-
300
- do {
301
- try shippingLabelResultsController. performFetch ( )
302
- } catch {
303
- DDLogError ( " ⛔️ Unable to fetch ShippingLabels for Site \( siteID) and Order \( order. orderID) : \( error) " )
304
- }
305
- }
306
-
307
267
private func configureAddOnGroupResultsController( onReload: @escaping ( ) -> Void ) {
308
268
addOnGroupResultsController. onDidChangeContent = {
309
269
onReload ( )
@@ -340,24 +300,6 @@ private extension OrderDetailsResultsControllers {
340
300
}
341
301
}
342
302
343
- private func configureFeeLinesResultsController( onReload: @escaping ( ) -> Void ) {
344
- feeLinesResultsController. onDidChangeContent = {
345
- onReload ( )
346
- }
347
-
348
- feeLinesResultsController. onDidResetContent = { [ weak self] in
349
- guard let self = self else { return }
350
- self . refetchAllResultsControllers ( )
351
- onReload ( )
352
- }
353
-
354
- do {
355
- try feeLinesResultsController. performFetch ( )
356
- } catch {
357
- DDLogError ( " ⛔️ Unable to fetch Order Fee lines for Site \( siteID) : \( error) " )
358
- }
359
- }
360
-
361
303
private func configureShippingMethodsResultsController( onReload: @escaping ( ) -> Void ) {
362
304
shippingMethodsResultsController. onDidChangeContent = {
363
305
onReload ( )
@@ -384,7 +326,6 @@ private extension OrderDetailsResultsControllers {
384
326
try ? refundResultsController. performFetch ( )
385
327
try ? trackingResultsController. performFetch ( )
386
328
try ? statusResultsController. performFetch ( )
387
- try ? shippingLabelResultsController. performFetch ( )
388
329
try ? addOnGroupResultsController. performFetch ( )
389
330
try ? sitePluginsResultsController. performFetch ( )
390
331
try ? shippingMethodsResultsController. performFetch ( )
0 commit comments