Merge pull request #12428 from cyrillefr/RedundantPresenceValidationOnBelongs_part_III

Fix RedundantPresenceValidationOnBelongs on two files
This commit is contained in:
Filipe
2024-05-15 18:21:52 +01:00
committed by GitHub
8 changed files with 75 additions and 15 deletions

View File

@@ -0,0 +1,28 @@
# frozen_string_literal: true
namespace :ofn do
namespace :data do
desc 'Checking missing required ids in Spree::StockItem'
task check_missing_required_missing_ids_in_spree_stock_items: :environment do
puts 'Checking for null stock_location_id'
ids = Spree::StockItem.where(stock_location_id: nil).pluck(:id)
if ids.empty?
puts 'No NULL stock_location_id found in spree_stock_items'
else
puts 'NULL stock_location_ids s have been found in spree_stock_items:'
print ids
end
puts 'Checking for null variant_id'
ids = Spree::StockItem.where(variant_id: nil).pluck(:id)
if ids.empty?
puts 'No NULL variant_id found in spree_stock_items'
else
puts 'NULL variant_ids s have been found in spree_stock_items:'
print ids
end
end
end
end

View File

@@ -0,0 +1,28 @@
# frozen_string_literal: true
namespace :ofn do
namespace :data do
desc 'Checking missing required ids in Spree::StockMovement'
task check_missing_required_missing_ids_in_spree_stock_movements: :environment do
puts 'Checking for null stock_item_id'
ids = Spree::StockMovement.where(stock_item_id: nil).pluck(:id)
if ids.empty?
puts 'No NULL stock_item_id found in spree_stock_movements'
else
puts 'NULL stock_item_ids s have been found in spree_stock_movements:'
print ids
end
puts 'Checking for null quantity'
ids = Spree::StockMovement.where(quantity: nil).pluck(:id)
if ids.empty?
puts 'No NULL quantity found in spree_stock_movements'
else
puts 'NULL quantity s have been found in spree_stock_movements:'
print ids
end
end
end
end