Esempio n. 1
0
File: views.py Progetto: tekd/noi2
def get_network_viz_data():
    counts = stats.get_questionnaire_counts()

    viz_data = []
    for qid, s in counts.items():
        area_info = {
            'name': QUESTIONNAIRES_BY_ID[qid]['name'],
            'total': s['learn'] + s['explain'] + s['connect'] + s['do']
        }
        area_info.update(skills_to_percentages(s))
        viz_data.append(area_info)
    viz_data = sorted(viz_data, key=lambda area_info: area_info['total'],
                      reverse=True)
    return viz_data
Esempio n. 2
0
def get_network_viz_data():
    counts = stats.get_questionnaire_counts()

    viz_data = []
    for qid, s in counts.items():
        area_info = {
            'name': QUESTIONNAIRES_BY_ID[qid]['name'],
            'total': s['learn'] + s['explain'] + s['connect'] + s['do']
        }
        area_info.update(skills_to_percentages(s))
        viz_data.append(area_info)
    viz_data = sorted(viz_data,
                      key=lambda area_info: area_info['total'],
                      reverse=True)
    return viz_data
Esempio n. 3
0
def network():
    '''
    View the network.
    '''

    counts = stats.get_questionnaire_counts()

    viz_data = []
    for qid, s in counts.items():
        total = s['learn'] + s['explain'] + s['connect'] + s['do']
        area_info = {
            'name': QUESTIONNAIRES_BY_ID[qid]['name'],
            'total': total
        }
        for skill_level in ['learn', 'explain', 'connect', 'do']:
            percentage = 0.0
            if total > 0:
                percentage = float(s[skill_level]) / total
            area_info[skill_level] = int(percentage * 100)
        viz_data.append(area_info)
    viz_data = sorted(viz_data, key=lambda area_info: area_info['total'],
                      reverse=True)
    return render_template('network.html', viz_data=viz_data)