Ejemplo n.º 1
0
def get_student_and_terms_by_sid(sid):
    student = data_loch.get_student_by_sid(sid)
    if student:
        return _construct_student_profile(student)
    else:
        profile_rows = data_loch.get_historical_student_profiles_for_sids([sid])
        return _construct_historical_student_profile(profile_rows)
Ejemplo n.º 2
0
def _student_to_json(sid):
    student = data_loch.get_student_by_sid(sid)
    if student:
        api_json = {camelize(key): student[key] for key in student.keys()}
    else:
        api_json = {}
    return {'student': api_json}
Ejemplo n.º 3
0
def _student_to_json(sid):
    student = data_loch.get_student_by_sid(sid)
    if student:
        api_json = {camelize(key): student[key] for key in student.keys()}
    else:
        profiles = data_loch.get_historical_student_profiles_for_sids([sid])
        api_json = json.loads(profiles[0].get('profile')) if profiles and profiles[0] else {}
    return {'student': api_json}
Ejemplo n.º 4
0
def _to_json(search_terms, search_result):
    appointment_id = search_result['id']
    student = data_loch.get_student_by_sid(search_result['student_sid'])
    api_json = {
        'id':
        appointment_id,
        'advisorName':
        search_result['advisor_name'],
        'advisorRole':
        search_result['advisor_role'],
        'advisorUid':
        search_result['advisor_uid'],
        'advisorDeptCodes':
        search_result['advisor_dept_codes'],
        'createdAt':
        _isoformat(search_result['created_at']),
        'createdBy':
        search_result['created_by'],
        'deptCode':
        search_result['dept_code'],
        'details':
        search_result['details'],
        'detailsSnippet':
        search_result_text_snippet(search_result['details'], search_terms,
                                   APPOINTMENT_SEARCH_PATTERN),
        'student': {camelize(key): student[key]
                    for key in student.keys()},
        'updatedAt':
        _isoformat(search_result['updated_at']),
        'updatedBy':
        search_result['updated_by'],
    }
    return {
        **api_json,
        **_appointment_event_to_json(appointment_id, search_result['status']),
    }
Ejemplo n.º 5
0
def get_student_and_terms_by_sid(sid):
    student = data_loch.get_student_by_sid(sid)
    return _construct_student_profile(student)
Ejemplo n.º 6
0
def get_student_and_terms_by_sid(sid):
    student = data_loch.get_student_by_sid(sid)
    if student:
        return _construct_student_profile(student)
    else:
        return _construct_historical_student_profile(sid=sid)