Skip to content

Commit

Permalink
Ajout Heure de début pour cours annulé
Browse files Browse the repository at this point in the history
Modification pour recherche du premier cours qui tient compte des cours annulés
  • Loading branch information
dathosim committed Sep 27, 2022
1 parent 8428ec3 commit e264aa8
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions pronote.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ast import If
import pronotepy
from pronotepy.dataClasses import Lesson
from pronotepy.ent import ac_lyon
from pronotepy.ent import ac_grenoble
from pronotepy.ent import ac_orleans_tours
Expand Down Expand Up @@ -32,6 +33,7 @@
longmax_devoir = 125 #nombre de caractère max dans la description des devoirs



#Connection à Pronote avec ou sans ENT
if ent:
if type_compte == "parent":
Expand Down Expand Up @@ -94,6 +96,8 @@

#Transformation Json des emplois du temps (J,J+1 et next)
jsondata['edt_aujourdhui'] = []
jsondata['edt_aujourdhui_debut'] = ""

for lesson in lessons_today:
index=lessons_today.index(lesson)
if not (lesson.start == lessons_today[index-1].start and lesson.canceled == True) :
Expand All @@ -112,10 +116,14 @@
'status': lesson.status,
'background_color': lesson.background_color,
})
if lesson.canceled == False and jsondata['edt_aujourdhui_debut'] == '' :
jsondata['edt_aujourdhui_debut'] = lesson.start.strftime("%H:%M")



jsondata['edt_demain'] = []
jsondata['edt_demain_debut'] = ""

for lesson in lessons_tomorrow:

index=lessons_tomorrow.index(lesson)
Expand All @@ -135,8 +143,11 @@
'status': lesson.status,
'background_color': lesson.background_color,
})
if lesson.canceled == False and jsondata['edt_demain_debut'] == '' :
jsondata['edt_demain_debut'] = lesson.start.strftime("%H:%M")

jsondata['edt_prochainjour'] = []
jsondata['edt_prochainjour_debut'] = ""
for lesson in lessons_nextday:
index=lessons_nextday.index(lesson)
if not (lesson.start == lessons_nextday[index-1].start and lesson.canceled == True) :
Expand All @@ -155,13 +166,18 @@
'annulation': lesson.canceled,
'status': lesson.status,
'background_color': lesson.background_color,
})
#print(json.dumps(jsondata['edt_prochainjour'], indent=4))
})
if lesson.canceled == False and jsondata['edt_prochainjour_debut'] == '' :
jsondata['edt_prochainjour_debut'] = lesson.start.strftime("%H:%M")
#print(json.dumps(jsondata['edt_prochainjour'], indent=4))


jsondata['edt_date'] = []
for lesson in lessons_specific:
index=lessons_specific.index(lesson)
if not (lesson.start == lessons_specific[index-1].start and lesson.canceled == True) :
if (lesson.start == lessons_specific[index-1].start) :
lesson.num
else:
if lesson.subject: cours_affiche = lesson.subject.name
else: cours_affiche = 'autre'
if lesson.detention == True: cours_affiche = 'RETENUE'
Expand All @@ -176,6 +192,7 @@
'salle': lesson.classroom,
'annulation': lesson.canceled,
'status': lesson.status,
'num': lesson.num,
'background_color': lesson.background_color,
})

Expand Down

0 comments on commit e264aa8

Please sign in to comment.