Created
June 28, 2022 12:58
-
-
Save carloscortegagna/1a053f351f42e6cd0acf3881c73ee4d0 to your computer and use it in GitHub Desktop.
This file contains 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
apartment = Apartment.find 3511 | |
msg = [] | |
apartment.reservations.where(checkout_date: (Date.new(2022,4,1)..Date.new(2022,4,31))).each do |r| | |
msg << "#{r.order.id} - ota_fee_franchisor #{r.ota_fee_franchisor.to_f} - ota_percentage #{r.ota_percentage.to_f} - apt guest_franchisor_fee #{apartment.guest_franchisor_fee(r.order.ota)&.to_f} - apt guest_percentage_fee #{apartment.guest_percentage_fee(r.order.ota)&.to_f}" | |
end | |
msg.each do |m| | |
p m | |
end | |
## | |
order = Order.find 233535 | |
line_ids = order.invoices.map{|i| i.invoice_lines.pluck(:id)}.flatten | |
lines = InvoiceLine.where(id: line_ids, product_code: Product::OTA_FEE_PM) | |
lines.first.update(ota_fee_franchisor: xxx) | |
lines.reload.map &:ota_fee_franchisor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment