Preserve courses with pending rooms and report precise graduate import errors

This commit is contained in:
david1465833828
2026-10-28 19:56:02 +08:00
parent 8713bce0ee
commit 21b0df9e33
17 changed files with 340 additions and 53 deletions
@@ -54,13 +54,6 @@ List<UndergraduateActivity> parseActivityData(
i + 1,
);
}
if (args[5].trim().isEmpty) {
throw UndergraduateActivityException(
'room_missing',
'课程活动未提供教室信息,请附带网页反馈',
i + 1,
);
}
final bitmap = args[6];
if (!RegExp(r'^0[01]+$').hasMatch(bitmap) ||
bitmap.length > 64 ||
@@ -109,7 +102,7 @@ List<UndergraduateActivity> parseActivityData(
args[1].trim(),
args[3].substring(0, suffix.start).trim(),
suffix[1]!,
args[5].trim(),
args[5].trim().isEmpty ? '教室待定' : args[5].trim(),
indices,
weeks,
),
@@ -103,7 +103,13 @@ class _UndergraduateAuthPageState extends State<UndergraduateAuthPage> {
if (route?.isCurrent == true) Navigator.pop(context);
messenger.showSnackBar(
SnackBar(
content: Text(exams == null ? '课表已导入,请核对学期开始日。' : '考试信息已更新'),
content: Text(
exams != null
? '考试信息已更新'
: draft!.courses.any((c) => c.room == '教室待定')
? '课表已导入,部分课程教室待定;请核对学期开始日。'
: '课表已导入,请核对学期开始日。',
),
),
);
} else if (controller.lastError != null) {
@@ -28,7 +28,8 @@ class UndergraduateTimetableAdapter {
table = html
.parse(content)
.querySelector('#manualArrangeCourseTable');
if (table == null || doc.querySelector('input[type="password"]') != null) {
if (table == null ||
doc.querySelector('input[type="password"]') != null) {
throw const FormatException('请先在学校网页打开课表');
}
final termIds = doc
@@ -161,7 +162,10 @@ class UndergraduateTimetableAdapter {
weeks: group.weeks,
source: source,
courseCode: info?.code ?? a.courseCode,
notes: info?.notes ?? '',
notes: [
if (info?.notes.isNotEmpty == true) info!.notes,
if (a.room == '教室待定') '学校未提供教室,请以学校最新安排为准并在公布后刷新课表。',
].join('\n'),
),
);
}