-
-
Save avidas/a3d454a33ff3e1446aae50ee9c800926 to your computer and use it in GitHub Desktop.
# JIRA: REVENG-121 | |
# cancel move in for Office 16-116 in Tower 49 for Gimbal EUAETK | |
begin | |
Rails.logger.info "JIRA REVENG-121 starting to cancel move in for Office 16-116 in Tower 49 for Gimbal EUAETK" | |
TenantService.switch_to_rest_of_world_tenant | |
pr = PrimaryReservation.find(600203682) | |
pr.canceled_at = DateTime.new | |
pr.save! | |
Rails.logger.info "JIRA REVENG-121 done canceling move in for Office 16-116 in Tower 49 for Gimbal EUAETK " | |
end | |
# cancel move out for office 337 in Yangping Luy for δΈζ΅·εθΎζεδΌ ζζιε ¬εΈ - KIB7YC | |
begin | |
Rails.logger.info "JIRA REVENG-121 starting to cancel move out for Office 337 for Gimbal EUAETK" | |
TenantService.switch_to_apac_tenant | |
reservable = Account.find_by_short_code("KIB7YC").primary_reservations.map(&:reservable).select { |res| res.type == "Office" && res.name == "337" }.first | |
pr = Account.find_by_short_code("KIB7YC").primary_reservations.where("reservable_id = #{reservable.id}").first | |
pr.ended_on = nil | |
pr.save! | |
Rails.logger.info "JIRA REVENG-121 done canceling move out for Office 337 for Gimbal EUAETK " | |
end |
pr is the primary reservation and reservable is the associated reservable with the reservation. It could be possible to do this with one query here. Since this was a script I was not too worried about performance.
first
reads better to me, I could update that.
Ok, looks good to me π
π
minor: .detect
does the same thing as .select{}.first
on line 9, should we say move in
instead of move out
also, if you just canceled move out should you revert all the changes that happened while we process move out? For example, since it is a confirmed move out. lots of associated reservations are changed and security refund reservations are created. should you revert those?
@novasponge for this account, everything else has been fixed manually by billing. we just need to cancel their move in.
π
@jhjwind what about the other one with cancel move out? Has billing fixed everything manually?
For the cancel move out case, I talked to Michelle about it and it did not seem like a concern to have the cms offer them discounts as need be. We should certainly consider the impact on our systems, but does not seem like an issue from ops perspective.
For canceling the move-out: isn't
reservable
the same aspr
? Why is query again for aprimary_reservation
with the samereservable.id
as the one we already have?Minor: do we have a stylistic preference for
[0]
vs.first
?