fix: import unpublished exam rooms and add opt-in school HTML feedback
This commit is contained in:
@@ -102,11 +102,26 @@ class UndergraduateExamAdapter {
|
||||
final explicitEmpty = RegExp(r'暂无考试|无考试安排|没有考试|暂无记录|没有符合条件的记录|没有数据|无数据')
|
||||
.hasMatch(table.text);
|
||||
for (final row in table.querySelectorAll('tr').skip(1)) {
|
||||
final cells = row.children
|
||||
.map((c) => c.text.replaceAll(RegExp(r'\s+'), ' ').trim())
|
||||
.toList();
|
||||
if (explicitEmpty && row.children.length == 1) continue;
|
||||
final cells = <String>[];
|
||||
for (final cell in row.children) {
|
||||
final value = cell.text.replaceAll(RegExp(r'\s+'), ' ').trim();
|
||||
final span = int.tryParse(cell.attributes['colspan'] ?? '1');
|
||||
if ((cell.attributes['rowspan'] ?? '1') != '1') {
|
||||
throw const FormatException('考试记录行合并结构无法识别');
|
||||
}
|
||||
if (span == 1) {
|
||||
cells.add(value);
|
||||
} else if (span == 2 &&
|
||||
cells.length == 4 &&
|
||||
RegExp(r'^[\[【]?考试情况尚未发布[\]】]?$').hasMatch(value)) {
|
||||
// EAMS merges the room and seat columns until it publishes them.
|
||||
cells.addAll([value, '']);
|
||||
} else {
|
||||
throw const FormatException('考试记录列合并结构无法识别');
|
||||
}
|
||||
}
|
||||
if (cells.length != 9) {
|
||||
if (explicitEmpty && cells.length == 1) continue;
|
||||
throw const FormatException('考试记录字段不完整');
|
||||
}
|
||||
final rowType = _type(cells[7]);
|
||||
|
||||
Reference in New Issue
Block a user