Пример #1
0
def add_chart():
    raw_data = json.loads(request.data.decode("utf-8"))
    
    # print(raw_data)
    # print(type(raw_data))
    # print("-----------------------")
    # print(raw_data['chart'])
    # print(type(raw_data['chart']))
    # print("-----------------------")
    # print(raw_data['value'])
    # print(type(raw_data['value']))
    
    # now = datetime.now()
    # current_time = now.strftime("%Y-%m-%d %H:%M:%S")

    # # _conn.create_database()
    # # data = ""
    # data = ("André Luiz", current_time)
    # _conn.insert("tb_user",data)
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
    dashboard.set_dashboard(raw_data)

    resp = Response(json.dumps('OK'), mimetype='application/json')
    resp.status_code = 200
    return resp
Пример #2
0
def evaluation_customizable_dashboard():
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)

    if (dashboard.has_active_without_default_charts()):
        return render_template('eduvis/frontend/dashboard/evaluate.html', userName=user.get_name(_user_id), dashboardType='customizable', charts_topic=dashboard.topic(without_default_charts=True), charts_id=dashboard.charts("id",without_default_charts=True), charts_layout=dashboard.charts("layout",without_default_charts=True), titleCharts=dashboard.title(without_default_charts=True), post_action="/eduvis/evaluation_customizable_dashboard/save/", data={})
    elif (dashboard.has_inactive_default_charts()):
        return redirect('/eduvis/modification_customizable_dashboard/')
    else:
        return redirect('/eduvis/interview/evaluation/')
Пример #3
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
Пример #4
0
def evaluation_customizable_dashboard_save():
    if request.method == 'POST':
        print("--------------------------------post_evaluation_customizable_dashboard--------------------------------")

        user = User(_conn)
        dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
        topics = dashboard.topic(without_default_charts=True)
        charts = dashboard.charts("id",without_default_charts=True)

        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='customizable', charts_topic=dashboard.topic(without_default_charts=True), charts_id=dashboard.charts("id",without_default_charts=True), charts_layout=dashboard.charts("layout",without_default_charts=True), titleCharts=dashboard.title(without_default_charts=True), post_action="/eduvis/evaluation_customizable_dashboard/save/", data=data)
        else:
            user.record_evaluation_dashboard(CUSTOMIZABLE_DASHBOARD_TYPE, data, _user_id)
    else:
        pass
    
    if(dashboard.has_inactive_default_charts()):
        return redirect('/eduvis/modification_customizable_dashboard/')
    else:
        return redirect('/eduvis/interview/evaluation/')
Пример #5
0
def modification_customizable_dashboard_save():
    if request.method == 'POST':
        print("--------------------------------post_modification_customizable_dashboard--------------------------------")

        user = User(_conn)
        dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
        topics = dashboard.topic(default_charts_inactive=True)
        charts = dashboard.charts("id",default_charts_inactive=True)

        data = {}
        for i in range(0,len(charts)):
            name = "T"+str(topics[i])+"@"+str(charts[i])
            data[name] = request.form[name]

        print(data)

        if '' in list(data.values()):
            return render_template('eduvis/frontend/dashboard/modification.html', userName=user.get_name(_user_id), dashboardType='customizable', charts_topic=dashboard.topic(default_charts_inactive=True), charts_id=dashboard.charts("id",default_charts_inactive=True), charts_layout=dashboard.charts("layout",default_charts_inactive=True), titleCharts=dashboard.title(default_charts_inactive=True), post_action="/eduvis/modification_customizable_dashboard/save/", data=data)
        else:
            user.record_evaluation_dashboard(CUSTOMIZABLE_DASHBOARD_TYPE, data, _user_id, evaluation=False)            
    else:
        pass

    return redirect('/eduvis/interview/evaluation/')
Пример #6
0
def navigation1(): # <!-- VG-11 -->
    user = User(_conn)
    customizable_dashboard_id = user.get_customizable_dashboard_id(_user_id)
    navigation = Navigation(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    dashboard = Dashboard(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/configure.html', userName=user.get_name(_user_id), charts_id=navigation.charts("id"), charts_layout=navigation.charts("layout"), titleCharts=navigation.title(), topic=navigation.topic(), charts_active=navigation.charts_active(), enableLeftMenu=CUSTOMIZABLE_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Пример #7
0
def age4(): # <!-- VG-06 -->
    user = User(_conn)
    customizable_dashboard_id = user.get_customizable_dashboard_id(_user_id)
    age = Age(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    dashboard = Dashboard(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/configure.html', userName=user.get_name(_user_id), charts_id=age.charts("age_forum_topic","id"), charts_layout=age.charts("age_forum_topic","layout"), titleCharts=age.title("age_forum_topic"), topic=age.topic("age_forum_topic"), charts_active=age.charts_active("age_forum_topic"), enableLeftMenu=CUSTOMIZABLE_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Пример #8
0
def materials2(): #  <!-- VG-02 -->
    user = User(_conn)
    customizable_dashboard_id = user.get_customizable_dashboard_id(_user_id)
    material = Material(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    dashboard = Dashboard(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/configure.html', userName=user.get_name(_user_id), charts_id=material.charts("access_materials","id"), charts_layout=material.charts("access_materials","layout"), titleCharts=material.title("access_materials"), topic=material.topic("access_materials"), charts_active=material.charts_active("access_materials"), enableLeftMenu=CUSTOMIZABLE_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Пример #9
0
def cluster2(): # <!-- VG-05 -->
    user = User(_conn)
    customizable_dashboard_id = user.get_customizable_dashboard_id(_user_id)
    cluster = Cluster(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    dashboard = Dashboard(_conn, _user_id, customizable_dashboard_id, CUSTOMIZABLE_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/configure.html', userName=user.get_name(_user_id), charts_id=cluster.charts("grades_assignments","id"), charts_layout=cluster.charts("grades_assignments","layout"), titleCharts=cluster.title("grades_assignments"), topic=cluster.topic("grades_assignments"), charts_active=cluster.charts_active("grades_assignments"), enableLeftMenu=CUSTOMIZABLE_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Пример #10
0
def customizable_dashboard():
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
    session['type_dashboard'] = CUSTOMIZABLE_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=CUSTOMIZABLE_DASHBOARD_TYPE, leftMenuInfo=left_menu_info(), amountSelectedVG=dashboard.amount_by_view())
Пример #11
0
def modification_customizable_dashboard():
    user = User(_conn)
    dashboard = Dashboard(_conn, _user_id, user.get_customizable_dashboard_id(_user_id), CUSTOMIZABLE_DASHBOARD_TYPE)
    return render_template('eduvis/frontend/dashboard/modification.html', userName=user.get_name(_user_id), dashboardType='customizable', charts_topic=dashboard.topic(default_charts_inactive=True), charts_id=dashboard.charts("id",default_charts_inactive=True), charts_layout=dashboard.charts("layout",default_charts_inactive=True), titleCharts=dashboard.title(default_charts_inactive=True), post_action="/eduvis/modification_customizable_dashboard/save/", data={})