From 9e3ff412f94275c9f0c2ef0d18adf546e100e816 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 27 Mar 2025 13:35:59 +1100 Subject: [PATCH] Simplify controller --- .../admin/dfc_product_imports_controller.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/dfc_product_imports_controller.rb b/app/controllers/admin/dfc_product_imports_controller.rb index 9b7c15a4e6..eae8c092b5 100644 --- a/app/controllers/admin/dfc_product_imports_controller.rb +++ b/app/controllers/admin/dfc_product_imports_controller.rb @@ -20,7 +20,7 @@ module Admin # Render table and let user decide which ones to import. @items = list_products(catalog) - @absent_items = absent_variants(catalog) + @absent_items = importer(catalog).absent_variants rescue URI::InvalidURIError flash[:error] = t ".invalid_url" redirect_to admin_product_import_path @@ -58,7 +58,7 @@ module Admin end @count = imported.compact.count - @reset_count = reset_absent_variants(catalog).count + @reset_count = importer(catalog).reset_absent_variants.count rescue ActionController::ParameterMissing => e flash[:error] = e.message redirect_to admin_product_import_path @@ -86,12 +86,8 @@ module Admin end end - def reset_absent_variants(catalog) - DfcCatalogImporter.new(@enterprise.supplied_variants, catalog).reset_absent_variants - end - - def absent_variants(catalog) - DfcCatalogImporter.new(@enterprise.supplied_variants, catalog).absent_variants + def importer(catalog) + DfcCatalogImporter.new(@enterprise.supplied_variants, catalog) end end end