Lenylvt commited on
Commit
2f5902a
1 Parent(s): 826d110

Upload 10 files

Browse files
Files changed (3) hide show
  1. app.py +1 -4
  2. pages/devoirs.py +3 -3
  3. pages/notes.py +31 -29
app.py CHANGED
@@ -4,7 +4,7 @@ from pronotepy import ENTLoginError
4
  from pronotepy.ent import *
5
 
6
  # Importez vos pages ici
7
- from pages import accueil, devoirs, notes, edt, contenu, info, vie_scolaire, conv, competence
8
 
9
  def main():
10
  # Configuration initiale de la page
@@ -69,7 +69,6 @@ def main():
69
  "📅 Emploi du temps": "edt",
70
  "📚 Devoirs": "devoirs",
71
  "📝 Notes": "notes",
72
- "🟢 Compétences": "competence",
73
  "📧 Messagerie": "conv",
74
  "i️ Informations": "info",
75
  "🕒 Vie Scolaire": "vie_scolaire"
@@ -100,8 +99,6 @@ def main():
100
  vie_scolaire.app(client)
101
  elif st.session_state.current_page == 'conv':
102
  conv.app(client)
103
- elif st.session_state.current_page == 'competence':
104
- competence.app(client)
105
 
106
  if st.sidebar.button('🚪 Déconnexion'):
107
  del st.session_state.client
 
4
  from pronotepy.ent import *
5
 
6
  # Importez vos pages ici
7
+ from pages import accueil, devoirs, notes, edt, contenu, info, vie_scolaire, conv
8
 
9
  def main():
10
  # Configuration initiale de la page
 
69
  "📅 Emploi du temps": "edt",
70
  "📚 Devoirs": "devoirs",
71
  "📝 Notes": "notes",
 
72
  "📧 Messagerie": "conv",
73
  "i️ Informations": "info",
74
  "🕒 Vie Scolaire": "vie_scolaire"
 
99
  vie_scolaire.app(client)
100
  elif st.session_state.current_page == 'conv':
101
  conv.app(client)
 
 
102
 
103
  if st.sidebar.button('🚪 Déconnexion'):
104
  del st.session_state.client
pages/devoirs.py CHANGED
@@ -33,9 +33,9 @@ def app(client):
33
 
34
  def display_homework_list(homeworks, client):
35
  for homework in homeworks:
36
- with st.expander(f"{"" if homework.done else ""} | {homework.subject.name} - *pour le {homework.date.strftime('%d/%m/%Y')}*"):
37
  st.markdown(f"""
38
- - **Statut :** {"Fait" if homework.done else "À faire"}
39
  - **Description :** {homework.description}
40
  """, unsafe_allow_html=True)
41
 
@@ -47,4 +47,4 @@ def display_homework_list(homeworks, client):
47
 
48
  def update_homework_status(homework, client):
49
  new_status = not homework.done
50
- homework.set_done(new_status)
 
33
 
34
  def display_homework_list(homeworks, client):
35
  for homework in homeworks:
36
+ with st.expander(f"{'' if homework.done else ''} | {homework.subject.name} - *pour le {homework.date.strftime('%d/%m/%Y')}*"):
37
  st.markdown(f"""
38
+ - **Statut :** {"Fait" if homework.done else "À faire"}
39
  - **Description :** {homework.description}
40
  """, unsafe_allow_html=True)
41
 
 
47
 
48
  def update_homework_status(homework, client):
49
  new_status = not homework.done
50
+ homework.set_done(new_status)
pages/notes.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  from collections import defaultdict
3
- from datetime import datetime
4
 
5
  def calculate_average(grades):
6
  total_points, total_coefficients = 0, 0
@@ -20,59 +19,62 @@ def calculate_average(grades):
20
  def app(client):
21
  st.title('📝 Notes')
22
 
 
23
  selected_period = st.selectbox("🧷 Sélectionner la période", ["Trimestre 1", "Trimestre 2", "Trimestre 3", "Année"])
24
 
 
25
  if selected_period == "Année":
26
  periods_to_display = client.periods
27
  else:
28
  periods_to_display = [period for period in client.periods if period.name == selected_period]
29
 
 
30
  tab_labels = sorted({grade.subject.name for period in periods_to_display for grade in period.grades})
31
 
 
32
  tabs = st.tabs(tab_labels)
33
 
34
  for tab, subject in zip(tabs, tab_labels):
35
  with tab:
 
36
  for period in periods_to_display:
 
37
  grades_by_subject = defaultdict(list)
38
  for grade in period.grades:
39
  grades_by_subject[grade.subject.name].append(grade)
40
 
 
41
  if subject in grades_by_subject:
42
  for grade in grades_by_subject[subject]:
43
- with st.expander(f"📝 {grade.grade}/{grade.out_of} | {'📎 ' + grade.comment if grade.comment else 'Et voilà, ça ne donne pas de nom !'} (📅 {grade.date.strftime('%d/%m/%Y')})"):
44
- # Display grade information using structured layout
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- st.markdown("### Informations Générales")
47
- st.write(f"**Commentaire**: {grade.comment if grade.comment else 'Pas de commentaire'}")
48
- col1, col2 = st.columns(2)
49
- with col1:
50
- st.metric(label="Date", value=grade.date.strftime("%d/%m/%Y"))
51
- with col2:
52
- st.metric(label="Coefficient", value=str(grade.coefficient))
53
 
54
- st.markdown("---")
55
-
56
- st.markdown("### Note")
57
- col1, col2, col3, col4 = st.columns(4)
58
- with col1:
59
- st.metric(label="Note de l'Élève", value=f"{grade.grade}/{grade.out_of}")
60
- with col2:
61
- st.metric(label="Moyenne de la Classe", value=f"{grade.average}/{grade.out_of}")
62
- with col3:
63
- st.metric(label="Minimum", value=f"{grade.min}/{grade.out_of}")
64
- with col4:
65
- st.metric(label="Maximum", value=f"{grade.max}/{grade.out_of}")
66
-
67
- all_grades = [grade for period in periods_to_display for grade in period.grades]
68
  overall_average = calculate_average(all_grades)
69
 
70
  st.subheader("⭐ Moyenne Générale")
71
  if isinstance(overall_average, str):
72
  st.write(overall_average)
73
  else:
74
- col1, col2 = st.columns(2)
75
- with col1:
76
- st.metric(label="Élève", value=f"{overall_average:.2f}/20")
77
- with col2:
78
- st.metric(label="Classe", value=f"NaN/20")
 
1
  import streamlit as st
2
  from collections import defaultdict
 
3
 
4
  def calculate_average(grades):
5
  total_points, total_coefficients = 0, 0
 
19
  def app(client):
20
  st.title('📝 Notes')
21
 
22
+ # Dropdown pour sélectionner la période
23
  selected_period = st.selectbox("🧷 Sélectionner la période", ["Trimestre 1", "Trimestre 2", "Trimestre 3", "Année"])
24
 
25
+ # Filtrer les périodes en fonction de la sélection
26
  if selected_period == "Année":
27
  periods_to_display = client.periods
28
  else:
29
  periods_to_display = [period for period in client.periods if period.name == selected_period]
30
 
31
+ # Créer une liste des matières pour les onglets
32
  tab_labels = sorted({grade.subject.name for period in periods_to_display for grade in period.grades})
33
 
34
+ # Créer des onglets pour les matières
35
  tabs = st.tabs(tab_labels)
36
 
37
  for tab, subject in zip(tabs, tab_labels):
38
  with tab:
39
+ # Afficher les notes pour toutes les périodes sélectionnées
40
  for period in periods_to_display:
41
+ # Organiser les notes par matière
42
  grades_by_subject = defaultdict(list)
43
  for grade in period.grades:
44
  grades_by_subject[grade.subject.name].append(grade)
45
 
46
+ # Afficher les notes pour la matière de l'onglet actuel
47
  if subject in grades_by_subject:
48
  for grade in grades_by_subject[subject]:
49
+ with st.expander(f"📝 {grade.grade}/{grade.out_of} | {"📎 " + grade.comment if grade.comment else "Et voilà, ça ne donne pas de nom !"} (📅 {grade.date})"):
50
+ st.markdown("### Information")
51
+ st.write(f"**Commentaire** : {grade.comment}")
52
+ st.write(f"**Date** : {grade.date}")
53
+ st.write(f"**Coefficient** : {grade.coefficient}")
54
+ if grade.is_bonus:
55
+ st.write(f"**Note Bonus** (*Est pris en compte seulement les points au-dessus de 10*)")
56
+ if grade.is_optionnal:
57
+ st.write(f"**Note Optionnelle** (*Est pris en compte seulement si la note augmente la moyenne*)")
58
+ st.markdown("### Eleve")
59
+ st.write(f"{grade.grade}/{grade.out_of}")
60
+ st.markdown("### Classe")
61
+ st.write(f"**Moyenne** : {grade.average}")
62
+ st.write(f"**Minimum** : {grade.min}")
63
+ st.write(f"**Maximum** : {grade.max}")
64
 
65
+ # Instead of directly calculating the overall average, gather all grades
66
+ all_grades = []
67
+ for period in periods_to_display:
68
+ for grade in period.grades:
69
+ all_grades.append(grade)
 
 
70
 
71
+ # Use the calculate_average function to calculate the overall average
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  overall_average = calculate_average(all_grades)
73
 
74
  st.subheader("⭐ Moyenne Générale")
75
  if isinstance(overall_average, str):
76
  st.write(overall_average)
77
  else:
78
+ st.write(f"### {overall_average:.2f}/20")
79
+
80
+