Skip to content

Instantly share code, notes, and snippets.

@avidas
Last active December 29, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avidas/68ddfebda9092b7594ff600c94f2de9a to your computer and use it in GitHub Desktop.
Save avidas/68ddfebda9092b7594ff600c94f2de9a to your computer and use it in GitHub Desktop.
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code '6HZMS1'
primary_reservations = account.primary_reservations.active.where(description: ['08-113', '08-100', '08-109'])
# Set commitment terms
start_date = Date.today.next_month.beginning_of_year
months = 12
primary_reservations.map{|res| CommitmentTermService.new(res).create(months, start_date) }
# Update escalation dates
#08-113: 11,200 until 02-01-2019
pr113 = primary_reservations.find { |p| p.description == '08-113' }
pr113.update_attributes(escalation_date: Date.parse("2019-02-01"), price: 11200.0)
#08-100: 67, 322 until 01-01-2019
pr100 = primary_reservations.find { |p| p.description == '08-100' }
pr100.update_attributes(escalation_date: Date.parse("2019-01-01"), price: 67322.0)
#08-109: 15, 833 until 01-01-2019
pr109 = primary_reservations.find { |p| p.description == '08-109' }
pr109.update_attributes(escalation_date: Date.parse("2019-01-01"), price: 15833.0)
end
@ianguffy
Copy link

👍

@sagross
Copy link

sagross commented Dec 29, 2017

👍

@jhjwind
Copy link

jhjwind commented Dec 29, 2017

👍

@jhjwind
Copy link

jhjwind commented Dec 29, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment