Skip to content

Instantly share code, notes, and snippets.

@gtan66
Created August 27, 2015 17:13
Show Gist options
  • Save gtan66/9f8ae614c499c294e848 to your computer and use it in GitHub Desktop.
Save gtan66/9f8ae614c499c294e848 to your computer and use it in GitHub Desktop.
Fix batch time stamp so that it is 8/17 EST
batches = [
{batch_number: 14625, location: "South Station" },
{ batch_number: 14626, location: "Chinatown"},
{ batch_number: 14627, location: "Wonder Bread"},
{ batch_number: 14628, location: "Dupont Circle"},
{ batch_number: 14629, location: "Soho West"},
{ batch_number: 14630, location: "Bryant Park"},
{ batch_number: 14631, location: "Park South"},
{ batch_number: 14632, location: "42nd Street"},
{ batch_number: 14633, location: "FiDi"},
{ batch_number: 14634, location: "SOMA"},
{ batch_number: 14635, location: "Golden Gate"}
]
batches.each{ |b|
@location = Location.find_by(name: b[:location])
credit_card_type = [nil, "unknown"]
payments = Payment.joins(:applied_to).deposited.includes(:applied_to => [:account, :location]).where(batch_number: b[:batch_number].to_s, credit_card_type: credit_card_type).where("account_balances.location_id = (?)", @location.id)
payments.each{ |p|
p.update_attributes({requested_at: p.requested_at + 10.hours, deposited_at: p.deposited_at + 10.hours})
p.reload
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment