Upload 12 files
Browse files- .streamlit/config.toml +2 -0
- app.py +6 -2
- pages/competence.py +66 -0
- pages/devoirs.py +3 -3
- pages/notes.py +29 -31
.streamlit/config.toml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[client]
|
2 |
+
showSidebarNavigation = false
|
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
|
8 |
|
9 |
def main():
|
10 |
# Configuration initiale de la page
|
@@ -50,7 +50,8 @@ def main():
|
|
50 |
|
51 |
if st.button('Connexion'):
|
52 |
try:
|
53 |
-
client = pronotepy.Client(url, username, password, getattr(pronotepy.ent, cas, None))
|
|
|
54 |
if client.logged_in:
|
55 |
st.session_state.client = client
|
56 |
st.experimental_rerun()
|
@@ -68,6 +69,7 @@ def main():
|
|
68 |
"📅 Emploi du temps": "edt",
|
69 |
"📚 Devoirs": "devoirs",
|
70 |
"📝 Notes": "notes",
|
|
|
71 |
"📧 Messagerie": "conv",
|
72 |
"i️ Informations": "info",
|
73 |
"🕒 Vie Scolaire": "vie_scolaire"
|
@@ -98,6 +100,8 @@ def main():
|
|
98 |
vie_scolaire.app(client)
|
99 |
elif st.session_state.current_page == 'conv':
|
100 |
conv.app(client)
|
|
|
|
|
101 |
|
102 |
if st.sidebar.button('🚪 Déconnexion'):
|
103 |
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, competence
|
8 |
|
9 |
def main():
|
10 |
# Configuration initiale de la page
|
|
|
50 |
|
51 |
if st.button('Connexion'):
|
52 |
try:
|
53 |
+
#client = pronotepy.Client(url, username, password, getattr(pronotepy.ent, cas, None))
|
54 |
+
client = pronotepy.Client("https://0952236p.index-education.net/pronote/eleve.html", "leny.levant", "Leny15@0", val_doise)
|
55 |
if client.logged_in:
|
56 |
st.session_state.client = client
|
57 |
st.experimental_rerun()
|
|
|
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 |
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
|
pages/competence.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from collections import defaultdict
|
3 |
+
|
4 |
+
def app(client):
|
5 |
+
st.title('🟢 Compétences')
|
6 |
+
|
7 |
+
# Dropdown to select the period
|
8 |
+
selected_period = st.selectbox("🧷 Sélectionner la période", ["Trimestre 1", "Trimestre 2", "Trimestre 3", "Année"])
|
9 |
+
|
10 |
+
# Filter periods based on the selection
|
11 |
+
if selected_period == "Année":
|
12 |
+
periods_to_display = client.periods
|
13 |
+
else:
|
14 |
+
periods_to_display = [period for period in client.periods if period.name == selected_period]
|
15 |
+
|
16 |
+
# Create a list of subjects for tabs
|
17 |
+
# Assuming evaluations have a subject attribute
|
18 |
+
tab_labels = sorted({evaluation.subject.name for period in periods_to_display for evaluation in period.evaluations})
|
19 |
+
|
20 |
+
# Create tabs for each subject
|
21 |
+
tabs = st.tabs(tab_labels)
|
22 |
+
|
23 |
+
def level_to_emoji(level):
|
24 |
+
mapping = {
|
25 |
+
"Très bonne maîtrise": "⭐ Très bonne maîtrise",
|
26 |
+
"Maîtrise satisfaisante": "🟢 Maîtrise satisfaisante",
|
27 |
+
"Maîtrise fragile": "🟠 Maîtrise fragile",
|
28 |
+
"Maîtrise insuffisante": "🔴 Maîtrise insuffisante"
|
29 |
+
}
|
30 |
+
return mapping.get(level, level) # Fallback to the original level if it doesn't match known levels
|
31 |
+
|
32 |
+
for tab, subject in zip(tabs, tab_labels):
|
33 |
+
with tab:
|
34 |
+
# Display competencies for all selected periods
|
35 |
+
for period in periods_to_display:
|
36 |
+
# Organize evaluations by subject
|
37 |
+
evaluations_by_subject = defaultdict(list)
|
38 |
+
for evaluation in period.evaluations:
|
39 |
+
evaluations_by_subject[evaluation.subject.name].append(evaluation)
|
40 |
+
|
41 |
+
# Display competencies for the current tab's subject
|
42 |
+
if subject in evaluations_by_subject:
|
43 |
+
for evaluation in evaluations_by_subject[subject]:
|
44 |
+
with st.expander(f"Évaluation: {evaluation.name} (📅 {evaluation.date.strftime('%d/%m/%Y')})"):
|
45 |
+
st.markdown("### Information générale")
|
46 |
+
col1, col2, col3 = st.columns(3)
|
47 |
+
with col1:
|
48 |
+
st.write(f"Nom")
|
49 |
+
st.write(f"##### **{evaluation.name}**")
|
50 |
+
with col2:
|
51 |
+
st.metric(label="Date", value=evaluation.date.strftime("%d/%m/%Y"))
|
52 |
+
with col3:
|
53 |
+
st.metric(label="Coefficient", value=str(evaluation.coefficient))
|
54 |
+
|
55 |
+
st.markdown("---")
|
56 |
+
|
57 |
+
st.markdown("### Compétences évaluées")
|
58 |
+
for acquisition in evaluation.acquisitions:
|
59 |
+
acq_col1, acq_col2, acq_col3 = st.columns([3, 2, 1])
|
60 |
+
with acq_col1:
|
61 |
+
st.write(f"{acquisition.name}")
|
62 |
+
with acq_col2:
|
63 |
+
# Use the function here to prepend the emoji to the level description
|
64 |
+
st.write(f"{level_to_emoji(acquisition.level)}")
|
65 |
+
with acq_col3:
|
66 |
+
st.write(f"Coefficient: {acquisition.coefficient}")
|
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"{"
|
37 |
st.markdown(f"""
|
38 |
-
- **Statut :** {"
|
39 |
- **Description :** {homework.description}
|
40 |
""", unsafe_allow_html=True)
|
41 |
|
@@ -43,7 +43,7 @@ def display_homework_list(homeworks, client):
|
|
43 |
unique_key = str(uuid.uuid4()) # Generate a unique key
|
44 |
|
45 |
# Use the unique key for the button to avoid DuplicateWidgetID error
|
46 |
-
st.button("
|
47 |
|
48 |
def update_homework_status(homework, client):
|
49 |
new_status = not homework.done
|
|
|
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 |
|
|
|
43 |
unique_key = str(uuid.uuid4()) # Generate a unique key
|
44 |
|
45 |
# Use the unique key for the button to avoid DuplicateWidgetID error
|
46 |
+
st.button("✅ Marquer comme fait" if not homework.done else "❌ Marquer comme à faire", key=unique_key, on_click=update_homework_status, args=(homework, client))
|
47 |
|
48 |
def update_homework_status(homework, client):
|
49 |
new_status = not homework.done
|
pages/notes.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from collections import defaultdict
|
|
|
3 |
|
4 |
def calculate_average(grades):
|
5 |
total_points, total_coefficients = 0, 0
|
@@ -19,62 +20,59 @@ def calculate_average(grades):
|
|
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} | {
|
50 |
-
|
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 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
79 |
-
|
80 |
-
|
|
|
|
|
|
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 |
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")
|