示例#1
0
def get_degree_checks(uid):
    sid = get_sid_by_uid(uid)
    if sid:
        return tolerant_jsonify(
            DegreeProgressTemplate.find_by_sid(student_sid=sid))
    else:
        raise ResourceNotFoundError('Student not found')
示例#2
0
def get_degree_checks(uid):
    sid = get_sid_by_uid(uid)
    if sid:
        degrees = DegreeProgressTemplate.find_by_sid(student_sid=sid)
        uids = list(
            set([d['createdByUid']
                 for d in degrees] + [d['updatedByUid'] for d in degrees]))
        calnet_users_by_uid = calnet.get_calnet_users_for_uids(app, uids)
        for degree in degrees:

            def _get_name(uid):
                return calnet_users_by_uid[uid][
                    'name'] if uid in calnet_users_by_uid else None

            degree['createdByName'] = _get_name(degree['createdByUid'])
            degree['updatedByName'] = _get_name(degree['updatedByUid'])
        return tolerant_jsonify(degrees)
    else:
        raise ResourceNotFoundError('Student not found')
示例#3
0
def _put_degree_checks_json(student):
    student['degreeChecks'] = DegreeProgressTemplate.find_by_sid(student_sid=student['sid']) if current_user.can_read_degree_progress else []