Пример #1
0
def get_favorites_event_speakers(event_id):
    user_id = flask_session['indico_user']
    if db_event.get_favorites_event(user_id, event_id):
        return Response(json.dumps(
            event_logic.get_event_speakers(event_id,
                                           int(request.args.get('page', 1)))),
                        mimetype='application/json')
    else:
        speakers = []
        favorites_sessions = db_session.get_favorites_event_sessions(
            user_id, event_id)
        contribs = []
        for session in favorites_sessions:
            current_session = session['session_slot']
            for slot in db_session.get_event_session_slots(
                    event_id, current_session['sessionId'], True):
                for contrib in slot['entries']:
                    contribs.append(contrib)
        contributions = db_contribution.get_favorites_event_contributions(
            user_id, event_id)
        for contribution in contributions:
            current_contribution = contribution['contribution']
            for speaker in current_contribution['presenters']:
                if not speaker in speakers:
                    speakers.append(speaker)
        for contribution in contribs:
            for speaker in contribution['presenters']:
                if not speaker in speakers:
                    speakers.append(speaker)

        return Response(json.dumps(sorted(speakers, key=lambda x: x['name'])),
                        mimetype='application/json')
Пример #2
0
def get_favorites_event_speakers(event_id):
    user_id = flask_session['indico_user']
    if db_event.get_favorites_event(user_id, event_id):
        return Response(json.dumps(event_logic.get_event_speakers(event_id, int(request.args.get('page', 1)))), mimetype='application/json')
    else:
        speakers = []
        favorites_sessions = db_session.get_favorites_event_sessions(user_id, event_id)
        contribs = []
        for session in favorites_sessions:
            current_session = session['session_slot']
            for slot in db_session.get_event_session_slots(event_id, current_session['sessionId'], True):
                for contrib in slot['entries']:
                    contribs.append(contrib)
        contributions = db_contribution.get_favorites_event_contributions(user_id, event_id)
        for contribution in contributions:
            current_contribution = contribution['contribution']
            for speaker in current_contribution['presenters']:
                if not speaker in speakers:
                    speakers.append(speaker)
        for contribution in contribs:
            for speaker in contribution['presenters']:
                if not speaker in speakers:
                    speakers.append(speaker)

        return Response(json.dumps(sorted(speakers, key=lambda x:x['name'])), mimetype='application/json')
Пример #3
0
def get_event_speakers(event_id):
    return Response(json.dumps(event.get_event_speakers(event_id, int(request.args.get('page', 1)))),
                    mimetype='application/json')
Пример #4
0
def get_event_speakers(event_id):
    return Response(json.dumps(
        event.get_event_speakers(event_id, int(request.args.get('page', 1)))),
                    mimetype='application/json')