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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
mairap = Account.find_by short_code: '5KH06R' | |
res = mairap.primary_reservations.active.find_by(description: 'DD34') | |
res.commitment_term.archive! | |
end |
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
begin | |
def cancel_price_escalation(account, location) | |
TenantService.switch_tenant_with_location_uuid(location.uuid) | |
prs = account.primary_reservations.active.select { |res| res.location_id == location.id } | |
prs.map{ |res| res.update_attributes(annual_escalator_rate: nil, escalation_date: nil) } | |
end | |
account = Account.find_by_short_code('2XL9P8') | |
raise 'Incorrect Account' unless account.name == 'IAIelta' |
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
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) } |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
nbc = Account.find_by_short_code 'A0XA74' | |
congress_res = nbc.primary_reservations.active.find_by(description: '16104') | |
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018 | |
ct_duration = 6 | |
CommitmentTermService.new(congress_res).create(ct_duration, ct_start) | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by_short_code 'B1F4AJ' | |
pr = account.primary_reservations.active.find_by(description: '411') | |
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018 | |
ct_duration = 12 | |
CommitmentTermService.new(pr).create(ct_duration, ct_start) | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by_short_code 'BJGQA0' | |
pr = account.primary_reservations.active.find_by(description: '9068') | |
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018 | |
ct_duration = 24 | |
CommitmentTermService.new(pr).update(ct_duration, ct_start) | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by short_code: 'F469UC' | |
res = account.primary_reservations.active.find_by(description: 'DD - 15') | |
# need to find this way since res.commitment_term won't show a future term | |
term = CommitmentTerm.find_by(termable: res) | |
term.archive! if term.active? | |
raise 'Still has active term' if term.reload.active? | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by_short_code '7MY9PT' | |
primary_reservations = account.primary_reservations.active.where(description: ['2132', '2133', '2134', '2135', '2137']) | |
# Set commitment terms | |
start_date = Date.today.next_month.beginning_of_year | |
months = 6 | |
primary_reservations.map{|res| CommitmentTermService.new(res).create(months, start_date) } | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by_short_code '1VHUN0' | |
pr = account.primary_reservations.active.find_by(description: '03-01') | |
pr.update_attributes(price: 23400.0) | |
end |
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
begin | |
TenantService.switch_to_rest_of_world_tenant | |
account = Account.find_by_short_code 'HUJW06' | |
pr = account.primary_reservations.active.find_by(description: '02-15') | |
pr.update_attributes(price: 4300.0) | |
end |