diff --git a/app/database.py b/app/database.py index 5d288e5..28719e9 100644 --- a/app/database.py +++ b/app/database.py @@ -61,4 +61,19 @@ class Session: cursor.execute("SELECT utilisateurs.user_id, username, nom, prenom, creation_date FROM utilisateurs " "JOIN sessions ON utilisateurs.user_id=sessions.user_id WHERE session_id=%s", (self.uuid,)) result = cursor.fetchall() - return User(*result[0]) \ No newline at end of file + return User(*result[0]) + + def fetch_grades(self): + cursor = self.db.db.cursor() + cursor.execute("SELECT matieres.libelle, devoirs.libelle, date, coefficient, valeur, maximum FROM notes " + "JOIN devoirs ON notes.id_devoir=devoirs.id_devoir " + "JOIN matieres ON devoirs.id_matiere=matieres.id_matiere WHERE id_eleve=%s", (self.user.id,)) + + result = cursor.fetchall() + dico = {} + for note in result: + if note[0] in dico: + dico[note[0]].append(note) + else: + dico[note[0]] = [note] + return dico \ No newline at end of file diff --git a/app/static/login.css b/app/static/login.css new file mode 100644 index 0000000..1681345 --- /dev/null +++ b/app/static/login.css @@ -0,0 +1,44 @@ +body { + width: clamp(400px, 65%, 800px); + margin: 50px auto; + font-family: "Montserrat", sans-serif; + text-align: center; +} + +form table { + margin: 30px auto; +} + +form input[type=text], form input[type=password] { + padding: 10px; + border: none; + background-color: #eee; + transition: 200ms background-color; +} + +form input[type=text]:hover, form input[type=password]:hover { + background-color: #ddd; +} + +input[type=submit] { + border: none; + background-color: dodgerblue; + color: white; + padding: 5px 10px; + border-radius: 3px; + transition: 200ms background-color, 200ms color; +} + +input[type=submit]:hover { + background-color: #ddd; + color: black; +} + +input[type=submit]:active { + background-color: #bbb; +} + +p.error-box { + padding: 10px; + background-color: #ef9a9a; +} \ No newline at end of file diff --git a/app/static/style.css b/app/static/style.css index 0b9fd0d..78ef17a 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -90,7 +90,13 @@ body { background-color: var(--theme-color-light); } +main { + margin: 10px; +} +.grade-report td, .grade-report th { + padding: 5px; +} footer { background-color: #46484d; diff --git a/app/templates/grades.html b/app/templates/grades.html index 6375858..0a8c119 100644 --- a/app/templates/grades.html +++ b/app/templates/grades.html @@ -8,15 +8,17 @@
{{ matiere }} | ||
---|---|---|
{{ note[1] }} | +{{ note[4] }}/{{ note[5] }} | +coeff. {{ note[3] }} | +
Vous pouvez utiliser les identifiants de démonstration : demo/demo.
+ {% if request.args["error"] %} +Nom d'utilisateur ou mot de passe invalide.
+ {% endif %} diff --git a/app/templates/timetable.html b/app/templates/timetable.html index dc6d7cb..6fa27d7 100644 --- a/app/templates/timetable.html +++ b/app/templates/timetable.html @@ -6,6 +6,6 @@