示例#1
0
def create_another_TLV_station(num_of_ws=1):
    # create another station in TLV
    tel_aviv = City.objects.get(name=u'תל אביב יפו')
    station_name = 'tel_aviv_%d' % (
        Station.objects.filter(city=tel_aviv).count() + 1)
    ws_names = []
    for i in range(num_of_ws):
        ws_names.append("%s_%s%d" % (station_name, "ws", i + 1))

    station = None
    for user_name in [station_name] + ws_names:
        user = User(username=user_name)
        user.set_password(user_name)
        user.save()

        if user_name == station_name:
            station = Station(name=station_name,
                              user=user,
                              number_of_taxis=5,
                              country=Country.objects.filter(code="IL").get(),
                              city=City.objects.get(name="תל אביב יפו"),
                              address='גאולה 12',
                              lat=32.071838,
                              lon=34.766906)
            station.save()
        else:
            ws = WorkStation(user=user,
                             station=station,
                             was_installed=True,
                             accept_orders=True)
            ws.save()

    return station
示例#2
0
def workstation_exit(request):
    workstation_id = request.GET.get("id")
    ws = WorkStation.by_id(workstation_id)
    if ws and not ws.station.debug:
        msg = u"%s closed the workstation module" % ws.station.name
        notify_by_email("Module Closed by Station", msg=msg)

        for num in CRITICAL_MESSAGES_CONTACT_LIST:
            send_sms(num, msg)

    return HttpResponse("OK")
示例#3
0
def workstation_exit(request):
    workstation_id = request.GET.get("id")
    ws = WorkStation.by_id(workstation_id)
    if ws and not ws.station.debug:
        msg = u"%s closed the workstation module" % ws.station.name
        notify_by_email("Module Closed by Station", msg=msg)

        for num in CRITICAL_MESSAGES_CONTACT_LIST:
            send_sms(num, msg)

    return HttpResponse("OK")
示例#4
0
def create_another_TLV_station(num_of_ws=1):
    # create another station in TLV
    tel_aviv = City.objects.get(name=u'תל אביב יפו')
    station_name = 'tel_aviv_%d' % (Station.objects.filter(city=tel_aviv).count()+1)
    ws_names = []
    for i in range(num_of_ws):
        ws_names.append("%s_%s%d" % (station_name, "ws", i+1))

    station = None
    for user_name in [station_name] + ws_names:
        user = User(username=user_name)
        user.set_password(user_name)
        user.save()

        if user_name == station_name:
            station = Station(name=station_name, user=user, number_of_taxis=5,
                                    country=Country.objects.filter(code="IL").get(), city=City.objects.get(name="תל אביב יפו"), address='גאולה 12', lat=32.071838, lon=34.766906)
            station.save()
        else:
            ws = WorkStation(user=user, station=station, was_installed = True, accept_orders = True)
            ws.save()

    return station
def create_test_work_stations():
    # two for test_station_1
    station = Station.objects.get(name=STATION_NAMES[0])
    ws1_name, ws2_name = WS_NAMES[0], WS_NAMES[1]
    ws1, ws2 = WorkStation(), WorkStation()
    ws1.user, ws2.user = User.objects.get(username=ws1_name), User.objects.get(
        username=ws2_name)
    ws1.station = ws2.station = station
    ws1.was_installed = ws2.was_installed = True
    ws1.accept_orders = ws2.accept_orders = True
    ws1.save()
    ws2.save()

    # and one for test_station_2
    station = Station.objects.get(name=STATION_NAMES[1])
    ws_name = WS_NAMES[2]
    ws = WorkStation()
    ws.user = User.objects.get(username=ws_name)
    ws.station = station
    ws.was_installed = True
    ws.accept_orders = True
    ws.save()
def create_test_work_stations():
    # two for test_station_1
    station = Station.objects.get(name=STATION_NAMES[0])
    ws1_name, ws2_name = WS_NAMES[0], WS_NAMES[1]
    ws1, ws2 = WorkStation(), WorkStation()
    ws1.user, ws2.user = User.objects.get(username=ws1_name), User.objects.get(username=ws2_name)
    ws1.station = ws2.station = station
    ws1.was_installed = ws2.was_installed= True
    ws1.accept_orders = ws2.accept_orders = True
    ws1.save()
    ws2.save()

    # and one for test_station_2
    station = Station.objects.get(name=STATION_NAMES[1])
    ws_name = WS_NAMES[2]
    ws = WorkStation()
    ws.user = User.objects.get(username=ws_name)
    ws.station = station
    ws.was_installed = True
    ws.accept_orders = True
    ws.save()