Last active
December 3, 2019 21:34
-
-
Save niyando/1b5ce0962bebdc4f834ecdf9627dfa63 to your computer and use it in GitHub Desktop.
create_work_queue_items
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
tallies = Tally.discharge.where(organization_id: [64,8,1]).where('started_at > (?)', DateTime.now - 30.hours).not_closed | |
tallies.each do |tally| | |
wq = tally.voyage.work_queue | |
next if wq.blank? | |
tally.tallied_cargos.each do |tallied_cargo| | |
next if tallied_cargo.work_queue_item.present? | |
tallied_cargo.organization.work_queue_items.create( | |
work_queue: tallied_cargo.tally.voyage.work_queue, | |
source: tallied_cargo.berth_area, | |
destination: tallied_cargo.tally.voyage.discharge_destination.suggested_yard_slot(tallied_cargo.container), | |
container: tallied_cargo.container, | |
voyage: tallied_cargo.tally.voyage, | |
tallied_cargo_id: tallied_cargo.id | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment