コード例 #1
0
def generate_repairing_event():
    time = datetime.datetime(year=ri(2000, 2018),
                             month=ri(1, 12),
                             day=ri(1, 28),
                             hour=ri(0, 23),
                             minute=ri(0, 59),
                             second=ri(0, 59))
    RepairingEvent.create(
        time=time,
        customer=Customer.get_by_id(ri(1,
                                       Customer.select().count())),
        workshop=Workshop.get_by_id(ri(1,
                                       Workshop.select().count())),
        car=Car.get_by_id(ri(1,
                             Car.select().count())),
        part=Part.get_by_id(ri(1,
                               Part.select().count())),
        price=ri(100, 10000))
コード例 #2
0
def generate_charging_event():
    # time = datetime.datetime(year=ri(2000, 2018), month=ri(1, 12), day=ri(1, 28), hour=ri(0, 23), minute=ri(0, 59),
    #                         second=ri(0, 59))
    time = datetime.datetime(year=2018,
                             month=5,
                             day=ri(1, 10),
                             hour=ri(0, 23),
                             minute=ri(0, 59),
                             second=ri(0, 59))
    ChargingEvent.create(time=time,
                         car=Car.get_by_id(ri(1,
                                              Car.select().count())),
                         customer=Customer.get_by_id(
                             ri(1,
                                Customer.select().count())),
                         charging_station=ChargingStation.get_by_id(
                             ri(1,
                                ChargingStation.select().count())),
                         price=ri(100, 10000))
コード例 #3
0
def generate_trip_event():
    pickup_time = datetime.datetime(year=ri(2015, 2018),
                                    month=ri(1, 12),
                                    day=ri(1, 28),
                                    hour=ri(0, 23),
                                    minute=ri(0, 59),
                                    second=ri(0, 59))
    end_time = (pickup_time + datetime.timedelta(hours=int(ri(1, 1000))))
    location = [str(i) + " street" for i in range(100, 131)]
    pickup_location = location[ri(0, 30)]
    destination_location = location[ri(0, 30)]
    distance_to_user = ri(0, 30000)
    trip_duration = ri(0, 2400)
    TripEvent.create(pickup_location=pickup_location,
                     pickup_time=pickup_time,
                     end_time=end_time,
                     destination_location=destination_location,
                     car=Car.get_by_id(ri(1,
                                          Car.select().count())),
                     distance_to_user=distance_to_user,
                     trip_duration=trip_duration,
                     customer=Customer.get_by_id(
                         ri(1,
                            Customer.select().count())))