Ejemplo n.º 1
0
def create_trip_update(id, trip_id, circulation_date, stops, status='update'):
    trip_update = TripUpdate(
        VehicleJourney(
            {
                'trip': {
                    'id': trip_id
                },
                'stop_times': [{
                    'arrival_time': datetime.time(8, 10),
                    'stop_point': {
                        'stop_area': {
                            'timezone': 'UTC'
                        }
                    }
                }]
            }, circulation_date), status)
    trip_update.id = id
    for stop in stops:
        st = StopTimeUpdate({'id': stop['id']}, stop['departure'],
                            stop['arrival'])
        st.arrival_status = stop['arrival_status']
        st.departure_status = stop['departure_status']
        trip_update.stop_time_updates.append(st)

    db.session.add(trip_update)
    return trip_update
Ejemplo n.º 2
0
def create_trip_update(
    id, trip_id, circulation_date, stops, status="update", contributor_id=GTFS_CONTRIBUTOR_ID
):
    trip_update = TripUpdate(
        VehicleJourney(
            {
                "trip": {"id": trip_id},
                "stop_times": [
                    {"utc_arrival_time": datetime.time(8, 10), "stop_point": {"stop_area": {"timezone": "UTC"}}}
                ],
            },
            datetime.datetime.combine(circulation_date, datetime.time(7, 10)),
            datetime.datetime.combine(circulation_date, datetime.time(9, 10)),
        ),
        contributor_id,
        status,
    )
    trip_update.id = id
    for stop in stops:
        st = StopTimeUpdate({"id": stop["id"]}, stop["departure"], stop["arrival"])
        st.arrival_status = stop["arrival_status"]
        st.departure_status = stop["departure_status"]
        trip_update.stop_time_updates.append(st)

    db.session.add(trip_update)
    return trip_update
Ejemplo n.º 3
0
def create_trip_update(id, trip_id, circulation_date, stops, status='update'):
    trip_update = TripUpdate(VehicleJourney({'trip': {'id': trip_id}}, circulation_date), status)
    trip_update.id = id
    for stop in stops:
        st = StopTimeUpdate({'id': stop['id']}, stop['departure'], stop['arrival'])
        st.arrival_status = stop['arrival_status']
        st.departure_status = stop['departure_status']
        trip_update.stop_time_updates.append(st)

    db.session.add(trip_update)
    return trip_update
Ejemplo n.º 4
0
def create_trip_update(id, trip_id, circulation_date, stops, status='update'):
    trip_update = TripUpdate(
        VehicleJourney({'trip': {
            'id': trip_id
        }}, circulation_date), status)
    trip_update.id = id
    for stop in stops:
        st = StopTimeUpdate({'id': stop['id']}, stop['departure'],
                            stop['arrival'])
        st.arrival_status = stop['arrival_status']
        st.departure_status = stop['departure_status']
        trip_update.stop_time_updates.append(st)

    db.session.add(trip_update)
    return trip_update