diff options
Diffstat (limited to 'ustayml/views')
| -rw-r--r-- | ustayml/views/dashboard.py | 37 | ||||
| -rw-r--r-- | ustayml/views/load_data.py | 2 | ||||
| -rw-r--r-- | ustayml/views/students.py | 2 |
3 files changed, 39 insertions, 2 deletions
diff --git a/ustayml/views/dashboard.py b/ustayml/views/dashboard.py index e69de29..0295c30 100644 --- a/ustayml/views/dashboard.py +++ b/ustayml/views/dashboard.py @@ -0,0 +1,37 @@ +import datetime +from flask import ( + Blueprint, flash, g, redirect, render_template, request, url_for +) +from werkzeug.exceptions import abort + +from ustayml.views.auth import login_required +from ustayml.db import get_db, get_paginated_rows, get_row + +bp = Blueprint('dashboard', __name__, url_prefix='/dashboard') + +@bp.route('/', methods=('GET', 'POST')) +@login_required +def index(): + db = get_db() + pucp_unit = db.execute("select * from pucp_unit;").fetchall() + semester = [{'id': x, 'name': x} for x in range(1, 13)] + desertion_risks_class = db.execute("select * from desertion_risk_class;").fetchall() + + # filter criteria | field choices + fc = { + 'pucp_unit': int(request.args.get('pucp_unit', 0)), + 'semester': int(request.args.get('semester', 0)), + 'desertion_risk_class': int(request.args.get('desertion_risk_class', 0)), + } + + return render_template( + 'dashboard/index.html', + # students=students, pagination=pagination, + pucp_unit=pucp_unit, + semester=semester, + desertion_risk_class=desertion_risks_class, + fc=fc + ) + return render_template( + 'dashboard/index.html' + ) diff --git a/ustayml/views/load_data.py b/ustayml/views/load_data.py index e57f40c..20833c2 100644 --- a/ustayml/views/load_data.py +++ b/ustayml/views/load_data.py @@ -25,7 +25,7 @@ def index(): # If the user does not select a file, the browser submits an # empty file without a filename. if file.filename == '': - flash('No selected file') + flash('Por favor, suba el diccionario de variables') return redirect(request.url) if file and allowed_file(file.filename): filename = secure_filename(file.filename) diff --git a/ustayml/views/students.py b/ustayml/views/students.py index 3b31790..c3ad563 100644 --- a/ustayml/views/students.py +++ b/ustayml/views/students.py @@ -77,6 +77,6 @@ def details(student_id): return render_template( 'students/details.html', - date=datetime.datetime.now(), + date=datetime.datetime(2023, 10, 26), student=s )
\ No newline at end of file |
