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/')
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/')
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/')