mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Merge pull request #12428 from cyrillefr/RedundantPresenceValidationOnBelongs_part_III
Fix RedundantPresenceValidationOnBelongs on two files
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user