Example #1
0
def get_faculty_schedule(_id):
    if not request.json or \
    not 'username' in request.json or not 'password' in request.json:
        abort(400)
    key = schedules.get_key(request.json['username'], request.json['password'])[0]
    if key is None:
        abort(401)

    return jsonify({'faculty_id': _id, 
        'schedule': schedules.select_faculty_calendar(_id, key)})
Example #2
0
def get_faculty_schedule(_id):
    if not request.json or \
    not 'username' in request.json or not 'password' in request.json:
        abort(400)
    key = schedules.get_key(request.json['username'],
                            request.json['password'])[0]
    if key is None:
        abort(401)

    return jsonify({
        'faculty_id': _id,
        'schedule': schedules.select_faculty_calendar(_id, key)
    })
Example #3
0
def compare_schedules(op1, op2):
    if not request.json or \
    not 'username' in request.json or not 'password' in request.json:
        abort(400)
    key, _id = schedules.get_key(request.json['username'], request.json['password'])
    if key is None:
        abort(401)

    if op1 == 'me':
        s1 = schedules.select_student_calendar(key, _id)
    else:
        s1 = schedules.select_faculty_calendar(op1, key)

    if op2 == 'me':
        s2 = schedules.select_student_calendar(key, _id)
    else:
        s2 = schedules.select_faculty_calendar(op2, key)

    return jsonify({
        'person1': op1 if op1 != 'me' else _id,
        'person2': op2 if op2 != 'me' else _id,
        'common_labs': labs.intersect_schedules(s1, s2)
        })
Example #4
0
def compare_schedules(op1, op2):
    if not request.json or \
    not 'username' in request.json or not 'password' in request.json:
        abort(400)
    key, _id = schedules.get_key(request.json['username'],
                                 request.json['password'])
    if key is None:
        abort(401)

    if op1 == 'me':
        s1 = schedules.select_student_calendar(key, _id)
    else:
        s1 = schedules.select_faculty_calendar(op1, key)

    if op2 == 'me':
        s2 = schedules.select_student_calendar(key, _id)
    else:
        s2 = schedules.select_faculty_calendar(op2, key)

    return jsonify({
        'person1': op1 if op1 != 'me' else _id,
        'person2': op2 if op2 != 'me' else _id,
        'common_labs': labs.intersect_schedules(s1, s2)
    })