Skip orphaned adjustments

There are a handful of enterprise fee adjustments on line items in production data where the line item has actually been deleted and no longer exists, but the fee adjustment is still in the database.
This commit is contained in:
Matt-Yorkley
2021-06-04 13:15:24 +01:00
parent d9f459d94a
commit 7ecd67a3fe

View File

@@ -72,7 +72,7 @@ class MigrateEnterpriseFeeTaxAmounts < ActiveRecord::Migration[5.0]
return if enterprise_fee.nil?
if line_item_fee?(fee) && enterprise_fee.inherits_tax_category?
fee.adjustable.product.tax_category
fee.adjustable&.product&.tax_category
else
enterprise_fee.tax_category
end