-
-
Save jesus-lerma/d317555de8cccb0e81fbaa801f65d63e to your computer and use it in GitHub Desktop.
I used this script to map the staging base env for bi clusters.
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
def create_scenario | |
mx_hour = Time.use_zone('America/Mexico_City') do | |
tz=Time.zone.now | |
(tz - tz.round(0).sec.seconds) | |
end | |
event=AuctionEvent.create( | |
name: "Auction Autocom", | |
status: :scheduled, | |
starts_at: mx_hour + 2.minutes, | |
ends_at: mx_hour + 3.minutes | |
) | |
ids = [ | |
8617, | |
8616, | |
7500, | |
7672, | |
7435, | |
8614, | |
8613, | |
8612 | |
] | |
vehicles = Vehicle.where(id: VehicleInspection.where(id: ids).pluck(:vehicle_id)) | |
vehicles.each do |vehicle| | |
Auction.create( | |
status: :pending, | |
vehicle: vehicle, | |
auction_event: event, | |
min_bid: vehicle.price | |
) | |
end | |
end |
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
# Primer Sección | |
class Api::V3::ContactNumbersController < ApplicationController | |
def create | |
.. | |
Refund.create | |
RefundTeam.notify | |
Charge.create_negative_charge | |
Client.notify | |
... | |
end | |
end | |
# Segunda Sección | |
class Api::V3::ContactNumbersController < ApplicationController | |
def create | |
.. | |
Refund.create_refund | |
... | |
end | |
end | |
class Refund < ApplicationRecord | |
def create_refund | |
create | |
RefundTeam.notify | |
Charge.create_negative_charge | |
Client.notify | |
end | |
end | |
# Tercer Seccion | |
class Api::V3::ContactNumbersController < ApplicationController | |
def create | |
.. | |
RefundService.new.call | |
... | |
end | |
end | |
class RefundService < ApplicationRecord | |
def call | |
Refund.create | |
RefundTeam.notify | |
Charge.create_negative_charge | |
Client.notify | |
end | |
end |
Honda CRV abierta
def create_scenario
mx_hour = Time.use_zone('America/Mexico_City') do
tz=Time.zone.now
(tz - tz.round(0).sec.seconds)
end
event=AuctionEvent.create(
name: "Auction Event Script",
status: :scheduled,
starts_at: mx_hour + 1.minutes,
ends_at: mx_hour + 10.minutes
)
ids = [4469]
vehicles = Vehicle.where(id: VehicleInspection.where(id: ids).pluck(:vehicle_id))
vehicles.each do |vehicle|
Auction.create(
status: :pending,
vehicle: vehicle,
auction_event: event,
min_bid: vehicle.price
)
end
end
def create_open_scenario
mx_hour = Time.use_zone('America/Mexico_City') do
tz=Time.zone.now
(tz - tz.round(0).sec.seconds)
end
event=AuctionEvent.create(
name: "Auction Event Script",
status: :scheduled,
starts_at: mx_hour + 1.minutes,
ends_at: mx_hour + 3.minutes
)
ids = [4469, 4436, 4470]
vehicles = Vehicle.where(id: VehicleInspection.where(id: ids).pluck(:vehicle_id))
vehicles.each do |vehicle|
Auction.create(
status: :pending,
vehicle: vehicle,
auction_event: event,
min_bid: vehicle.price
)
end
end
def create_scheduled_scenario
mx_hour = Time.use_zone('America/Mexico_City') do
tz=Time.zone.now
(tz - tz.round(0).sec.seconds)
end
event=AuctionEvent.create(
name: "Auction Event Script",
status: :scheduled,
starts_at: mx_hour + 2.hours,
ends_at: mx_hour + 3.hours
)
ids = [4390, 473, 428, 545, 390, 4413]
vehicles = Vehicle.where(id: VehicleInspection.where(id: ids).pluck(:vehicle_id))
vehicles.each do |vehicle|
Auction.create(
status: :pending,
vehicle: vehicle,
auction_event: event,
min_bid: vehicle.price
)
end
end
def create_open_scenario
mx_hour = Time.use_zone('America/Mexico_City') do
tz=Time.zone.now
(tz - tz.round(0).sec.seconds)
end
event=AuctionEvent.create(
name: "Autocom Event Script",
status: :scheduled,
starts_at: mx_hour + 1.minutes,
ends_at: mx_hour + 3.minutes
)
ids = [4388]
vehicles = Vehicle.where(id: VehicleInspection.where(id: ids).pluck(:vehicle_id))
vehicles.each do |vehicle|
Auction.create(
status: :pending,
vehicle: vehicle,
auction_event: event,
min_bid: vehicle.price
)
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vehículos Autocom