Beispiel #1
0
def assignments(request):

    lat, lng, start, count, language_code, cuid, new_client = get_client_info(
        request)

    client = Clients.get_client_by_cuid(
        session=DBSession,
        cuid=cuid,
        lat=lat,
        lng=lng,
    )

    Clients.check_in(
        session=DBSession,
        cuid=cuid,
        lat=lat,
        lng=lng,
    )

    assignments = client_utils.get_assignments(
        client_id=client.client_id,
        language_code=language_code,
        lat=lat,
        lng=lng,
    )

    return {
        'new_client': new_client,
        'cuid': cuid,
        'client': client,
        'lat': lat,
        'lng': lng,
        'assignments': assignments
    }
def assignments(request):

    lat, lng, start, count, language_code, cuid, new_client = get_client_info(request)

    client = Clients.get_client_by_cuid(session=DBSession, cuid=cuid, lat=lat, lng=lng)

    Clients.check_in(session=DBSession, cuid=cuid, lat=lat, lng=lng)

    assignments = client_utils.get_assignments(
        client_id=client.client_id, language_code=language_code, lat=lat, lng=lng
    )

    return {
        "new_client": new_client,
        "cuid": cuid,
        "client": client,
        "lat": lat,
        "lng": lng,
        "assignments": assignments,
    }
def get_assignments(request):

    result = {'success': False}
    status_code = 200

    try:
        success, error_text, language_code, lat, lng, \
            client = client_utils.register_client(request)
        if success == False:
            raise Exception(error_text)

        assignments = client_utils.get_assignments(
            client_id=client.client_id,
            language_code=language_code,
            lat=lat,
            lng=lng,
        )

        result['assignments'] = assignments
        result['success'] = True

    except Exception, e:
        status_code = 400
        result['error_text'] = str(e)
def get_assignments(request):

    result = {'success': False}
    status_code = 200

    try:
        success, error_text, language_code, lat, lng, \
            client = client_utils.register_client(request)
        if success == False:
            raise Exception(error_text)

        assignments = client_utils.get_assignments(
            client_id = client.client_id,
            language_code = language_code,
            lat = lat,
            lng = lng,
        )

        result['assignments'] = assignments
        result['success'] = True

    except Exception, e:
        status_code = 400
        result['error_text'] = str(e)