File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
WooCommerce/Classes/ViewRelated/Products/Variations Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,20 @@ final class ProductVariationsViewModel {
2929 ///
3030 func generateAllVariations( for product: Product ) {
3131 let action = ProductVariationAction . synchronizeAllProductVariations ( siteID: product. siteID, productID: product. productID) { result in
32- // Temp
33- let fetched = ServiceLocator . storageManager. viewStorage. loadProductVariations ( siteID: product. siteID, productID: product. productID)
34- print ( " Synchronized \( fetched? . count ?? 0 ) variations " )
32+ // TODO: Fetch this via a results controller
33+ let existingVariations = ServiceLocator . storageManager. viewStorage. loadProductVariations ( siteID: product. siteID, productID: product. productID) ?
34+ . map {
35+ $0. toReadOnly ( )
36+ } ?? [ ]
37+
38+ // TEMP
39+ let variationsToGenerate = ProductVariationGenerator . generateVariations ( for: product, excluding: existingVariations)
40+ print ( " Variations to Generate: \( variationsToGenerate. count) " )
41+
3542 }
3643 stores. dispatch ( action)
3744
3845 // TODO:
39- // - Generate all variations locally
40- // - Substract already created variations
4146 // - Alert if there are more than 100 variations to create
4247 // - Create variations remotely
4348 }
You can’t perform that action at this time.
0 commit comments