extractTestStudent function

TestStudent extractTestStudent(
  1. Bs4Element row,
  2. bool hasPrep
)

Implementation

TestStudent extractTestStudent(Bs4Element row, bool hasPrep) {
  var id = int.parse(row.children[0].text.split(" ")[1]);
  var name = row.children[1].text;
  DateTime? preparingStart;
  var testDate = testDateFormat.parse(row.children[3].text);
  var add = hasPrep ? 1 : 0;
  if (hasPrep) {
    preparingStart = testTimeFormat.parse(row.children[4].text).copyWith(
        year: testDate.year, month: testDate.month, day: testDate.day);
  }
  var testStart = testTimeFormat
      .parse(row.children[4 + add].text)
      .copyWith(year: testDate.year, month: testDate.month, day: testDate.day);

  var testEnd = testTimeFormat
      .parse(row.children[5 + add].text)
      .copyWith(year: testDate.year, month: testDate.month, day: testDate.day);

  return TestStudent(id, name, testDate, testEnd, testStart, preparingStart);
}