コード例 #1
0
ファイル: client_views.py プロジェクト: Z4P0/yellr-server
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
    }
コード例 #2
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,
    }
コード例 #3
0
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)
コード例 #4
0
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)