Skip to content

Instantly share code, notes, and snippets.

@bennycwong
Created January 28, 2020 03:18
Show Gist options
  • Select an option

  • Save bennycwong/d823623cc6b65db6a61892a0a705835b to your computer and use it in GitHub Desktop.

Select an option

Save bennycwong/d823623cc6b65db6a61892a0a705835b to your computer and use it in GitHub Desktop.
#put oids in here
oids = %w(
)
orders = Order.where(id: oids).where(status: 'canceled_by_seller_review');
puts "Orders to extend: #{orders.count}"
errors = {}
orders.each do |order, index|
begin
puts "index: #{index} -- START #{order.id}"
if order.reload.status == 'canceled_by_seller_review'
order.seller_canceled_at = order.seller_canceled_at + 1.year
order.save!
else
e = "ERROR: Not longer canceled by seller review"
errors[oid] = e
end
rescue => exception
puts "ERROR #{exception.to_s}"
errors[oid] = exception.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment