Esempio n. 1
0
def evaluation_static_dashboard_save():
    if request.method == 'POST':
        print("--------------------------------post_evaluation_static_dashboard--------------------------------")

        user = User(_conn)
        dashboard = Dashboard(_conn, _user_id, user.get_static_dashboard_id(_user_id), STATIC_DASHBOARD_TYPE)
        topics = dashboard.topic()
        charts = dashboard.charts("id")

        keys = []
        form = request.form
        for key in form.keys():
            keys.append(key)

        data = {}
        for i in range(0,len(charts)):
            name = "T"+str(topics[i])+"@"+str(charts[i])
            data[name] = request.form[name]
            
            name = "T"+str(topics[i])+"@"+str(charts[i])+"#Radio"
            if name in keys:
                data[name] = request.form[name]
            else:
                data[name] = ''
        print(data)

        if '' in list(data.values()):
            return render_template('eduvis/frontend/dashboard/evaluate.html', userName=user.get_name(_user_id), dashboardType='static', charts_topic=dashboard.topic(), charts_id=dashboard.charts("id"), charts_layout=dashboard.charts("layout"), titleCharts=dashboard.title(), post_action="/eduvis/evaluation_static_dashboard/save/", data=data)
        else:
            user.record_evaluation_dashboard(STATIC_DASHBOARD_TYPE, data, _user_id)
    else:
        pass

    return redirect('/eduvis/customizable_dashboard/')
Esempio n. 2
0
def set_order():
    raw_data = json.loads(request.data.decode("utf-8"))
    
    print("Set Order")
    print(raw_data)
    
    user = User(_conn)

    if (session['type_dashboard'] == STATIC_DASHBOARD_TYPE):
        print('static_dashboard')
        dashboard = Dashboard(_conn, _user_id, user.get_static_dashboard_id(_user_id), STATIC_DASHBOARD_TYPE)
        dashboard.set_order(raw_data)
    elif (session['type_dashboard'] == CUSTOMIZABLE_DASHBOARD_TYPE):
        print('customizable_dashboard')
        dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
        dashboard.set_order(raw_data)

    resp = Response(json.dumps('OK'), mimetype='application/json')
    resp.status_code = 200
    return resp
Esempio n. 3
0
def static_dashboard():
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_static_dashboard_id(_user_id), STATIC_DASHBOARD_TYPE)
    session['type_dashboard'] = STATIC_DASHBOARD_TYPE
    return render_template('eduvis/frontend/dashboard/dashboard.html', userName=user.get_name(_user_id), charts_topic=dashboard.topic(), charts_id=dashboard.charts("id"), charts_layout=dashboard.charts("layout"), titleCharts=dashboard.title(), enableLeftMenu=STATIC_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Esempio n. 4
0
def evaluation_static_dashboard():
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_static_dashboard_id(_user_id), STATIC_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/evaluate.html', userName=user.get_name(_user_id), dashboardType='static', charts_topic=dashboard.topic(), charts_id=dashboard.charts("id"), charts_layout=dashboard.charts("layout"), titleCharts=dashboard.title(), post_action="/eduvis/evaluation_static_dashboard/save/", data={})