Inability to Distinguish Canceled Lessons from Room Changes in Timetable · Issue #311 · bain3/pronotepy · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a lesson experiences a "Changement de salle" (room change), the timetable returns two lessons:
Old Lesson (with the old room):
Marked with canceled=True.
status is "Cours annulé".
This lesson represents the original scheduling before the room change.
New Lesson (with the new room):
Marked with canceled=False.
status is "Changement de salle".
There is no explicit flag indicating that this lesson is the updated one due to a room change.
This setup makes it challenging to differentiate between a normal canceled lesson and the old lesson from a room change event, as both have canceled=True and status as "Cours annulé".
As shown, there's no way to differentiate between a normal canceled lesson and the old lesson from a room change based solely on the canceled field and status.
Findings:
Upon inspecting the Pronote API response, there's an additional field "G" that helps differentiate between these cases:
The old lesson from a room change has "G": 3, "Statut": "Cours annulé", and "estAnnule": true.
The normal canceled lesson has "G": 0, "Statut": "Cours annulé", and "estAnnule": true.
Suggested Solution:
Modify the library to handle room changes appropriately by introducing a room_changed parameter and filtering out the old lessons from room changes.
Add a room_changed Property:
Introduce a new property room_changed in the Lesson class.
This property should be True for lessons that are the result of a room change (i.e., the new lesson with the new room and status == "Changement de salle").
For all other lessons, room_changed should be False.
Filter Out the Old Lesson:
Modify the library to exclude the old lesson (the one with canceled=True, status="Cours annulé", and "G": 3) from the timetable results.
Only include the new lesson (with the new room) in the timetable data.
Implementation Details:
Parsing Logic Adjustments:
When parsing lessons from the API response, check the "G" and status fields:
If G == 3 and estAnnule == True:
Recognize this lesson as the old lesson from a room change.
Do not include this lesson in the timetable.
If status == "Changement de salle":
Set room_changed = True for this lesson.
Include this lesson in the timetable.
For all other lessons, proceed as usual.
Resulting Behavior:
The timetable will only display:
Normal lessons.
Normal canceled lessons.
New lessons from room changes, marked with room_changed=True.
Old lessons from room changes will be excluded, reducing confusion and redundancy.
Benefits:
Clarity: By excluding the old lessons and adding a room_changed flag, the timetable becomes clearer and more accurate.
Simplicity: Developers won't need to implement additional logic to filter out old lessons or detect room changes.
Consistency: Aligns the library's output with user expectations by only showing relevant and actionable lessons.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
When a lesson experiences a "Changement de salle" (room change), the timetable returns two lessons:
canceled=True
.status
is"Cours annulé"
.canceled=False
.status
is"Changement de salle"
.This setup makes it challenging to differentiate between a normal canceled lesson and the old lesson from a room change event, as both have
canceled=True
andstatus
as"Cours annulé"
.Examples:
As shown, there's no way to differentiate between a normal canceled lesson and the old lesson from a room change based solely on the
canceled
field andstatus
.Findings:
Upon inspecting the Pronote API response, there's an additional field
"G"
that helps differentiate between these cases:Snippet from Pronote API Response:
Old Lesson (from a room change):
Normal Canceled Lesson:
In these snippets, you can see:
"G": 3
,"Statut": "Cours annulé"
, and"estAnnule": true
."G": 0
,"Statut": "Cours annulé"
, and"estAnnule": true
.Suggested Solution:
Modify the library to handle room changes appropriately by introducing a
room_changed
parameter and filtering out the old lessons from room changes.Add a
room_changed
Property:room_changed
in theLesson
class.True
for lessons that are the result of a room change (i.e., the new lesson with the new room andstatus == "Changement de salle"
).room_changed
should beFalse
.Filter Out the Old Lesson:
canceled=True
,status="Cours annulé"
, and"G": 3
) from the timetable results.Implementation Details:
Parsing Logic Adjustments:
"G"
andstatus
fields:G == 3
andestAnnule == True
:status == "Changement de salle"
:room_changed = True
for this lesson.Resulting Behavior:
room_changed=True
.Benefits:
room_changed
flag, the timetable becomes clearer and more accurate.The text was updated successfully, but these errors were encountered: