Skip to content

Lesson notes, absence marking and resolving

Developer From Jokela edited this page Nov 20, 2020 · 2 revisions

To get a list of lesson notes, call SDK function getLessonNotes(). The call will return you LessonNotesResult class if request went successfully. The class has two variables:

  • lesson_notes, list of lesson notes
  • excuses_allowed, if this variable is True, this role/wilma account is able to mark absences and resolve lesson notes.

Lesson note dict structure:

{
    "id": 90415644,
    "timestamp": datetime.date(2020, 11, 13),
    "duration": 45,
    "teacher": {"id": 118, "name": "Hypoteesi Heikki", "code": "HYP"},
    "course": {"id": 846, "name": "Fysiikka 9k"},
    "type": {
        "id": 5,
        "codeName": "MOK",
        "shortName": "Luv myöhästyminen",
        "name": "Luvallinen myöhästyminen",
    },
    "disc": {"id": -1, "name": None},
    "colors": {"foreground": "#FFFFFF", "background": "#468C8C"},
    "info": None,
    "requiresClearance": False,
}

  • requiresClearance, if boolean is True, this lesson note needs to be resolved. Documentation goes more on that below.
  • info, String or None, when not None, contains teacher's note about the lesson note.

Marking absences

Marking absences is only possible when lesson notes result's excuses_allowed is True When marking absences, firstly you should retrieve all available absence reasons with this SDK call: getAbsenceReasons

If successfully executed, it will return ExcuseReasonsResult class, which has reasons in reasons['excuses'], and reasons['reportDate'], which needs to be supplied to marking request.

NOTE: Absence marking is available, when reasons['available'] is True.

Reason's dict structure:

{
    'id': 8,
    'caption': 'Luvallinen poissaolo',
    'explanationAllowed': False
}

To mark the absence, call it via SDK like in this example:

absenceReasons = sdk.getAbsenceReasons()
reason = absenceReasons.reasons['excuses']
sdk.markAbsence()
Clone this wiki locally