Created
September 6, 2019 00:32
-
-
Save guillec/004cdc909f5e0d161d009b233f012864 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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