示例#1
0
def update_stations():
    today = datetime.datetime.now().date()
    bikes = Bike.objects.filter(active=True)
    for bike in bikes:
        last_borrow = borrow_control.get_prev_borrow(bike, today)
        if last_borrow and last_borrow.dest != bike.station:
            bike.station = last_borrow.dest
            bike.save()
示例#2
0
def update_stations():
    today = datetime.datetime.now().date()
    bikes = Bike.objects.filter(active=True)
    for bike in bikes:
        last_borrow = borrow_control.get_prev_borrow(bike, today)
        if last_borrow and last_borrow.dest != bike.station:
            bike.station = last_borrow.dest
            bike.save()
示例#3
0
def _change_station(account, bike, station):
    today = datetime.datetime.now().date()
    prev_borrow = borrow_control.get_prev_borrow(bike, today)
    if prev_borrow:
        prev_borrow.dest = station
        prev_borrow.save()
        borrow_control.log(account, prev_borrow, "Changed Drop-Off station.",
                           "EDIT")
    yesterday = today + datetime.timedelta(days=-1)
    next_borrow = borrow_control.get_next_borrow(bike, yesterday)
    if next_borrow:
        next_borrow.src = station
        next_borrow.save()
        borrow_control.log(account, next_borrow, "Changed Pick-Up station",
                           "EDIT")
示例#4
0
def _change_station(account, bike, station):
    today = datetime.datetime.now().date()
    prev_borrow = borrow_control.get_prev_borrow(bike, today)
    if prev_borrow:
        prev_borrow.dest = station
        prev_borrow.save()
        borrow_control.log(account, prev_borrow, 
                           "Changed Drop-Off station.", "EDIT")
    yesterday = today + datetime.timedelta(days=-1)
    next_borrow = borrow_control.get_next_borrow(bike, yesterday)
    if next_borrow:
        next_borrow.src = station
        next_borrow.save()
        borrow_control.log(account, next_borrow, 
                           "Changed Pick-Up station", "EDIT")