extractAbsence function

Future<List<AbsenceEntry>> extractAbsence(
  1. BeautifulSoup soup,
  2. Student student
)

Implementation

Future<List<AbsenceEntry>> extractAbsence(
    BeautifulSoup soup, Student student) async {
  List<AbsenceEntry> entries = [];
  Bs4Element? absenceTable =
      soup.find('*', id: 's_m_Content_Content_SFTabStudentAbsenceDataTable');
  if (absenceTable == null) {
    return entries;
  }
  List<Bs4Element> unparsedRows = absenceTable.children[0].children;
  unparsedRows.removeRange(0, 3);
  unparsedRows.removeLast();
  for (var i = 0; i < unparsedRows.length; i++) {
    var row = unparsedRows[i];
    var entry = extractAbsenceEntry(row);
    if (entry != null) {
      entries.add(entry);
    }
    // get team
  }
  return entries;
}