Skip to content

Instantly share code, notes, and snippets.

@guillec
Created September 6, 2019 00:32
Show Gist options
  • Save guillec/004cdc909f5e0d161d009b233f012864 to your computer and use it in GitHub Desktop.
Save guillec/004cdc909f5e0d161d009b233f012864 to your computer and use it in GitHub Desktop.
dut = Organization.find(61)
bookings = dut.bookings.where(voyage_number: "0MQ35W1")
bookings.each do |booking|
booking.containers.each do |container|
last_movement = container.previous_movement
if last_movement.gate_in? && last_movement.booking.nil?
bookings = container.bookings.where(voyage_number: "0MQ35W1")
bookings.each do |booking|
bc = booking.booking_containers.where(container_id: container.id)
bc.container_id = nil
bc.save
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment