fix: import unpublished exam rooms and add opt-in school HTML feedback
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
class UndergraduateActivityException extends FormatException {
|
||||
const UndergraduateActivityException(
|
||||
this.code,
|
||||
String message,
|
||||
this.activityNumber,
|
||||
) : super(message);
|
||||
final String code;
|
||||
final int activityNumber;
|
||||
}
|
||||
|
||||
class UndergraduateActivity {
|
||||
UndergraduateActivity(
|
||||
this.teacher,
|
||||
@@ -30,8 +40,26 @@ List<UndergraduateActivity> parseActivityData(
|
||||
final m = matches[i], args = _strings(m[1]!);
|
||||
if (args.length != 7) throw const FormatException('课程活动字段不完整');
|
||||
final suffix = RegExp(r'\(([A-Za-z0-9_.-]+)\)$').firstMatch(args[3]);
|
||||
if (suffix == null || args[1].trim().isEmpty || args[5].trim().isEmpty) {
|
||||
throw const FormatException('教师、教室或课程序号缺失');
|
||||
if (suffix == null) {
|
||||
throw UndergraduateActivityException(
|
||||
'course_sequence_invalid',
|
||||
'课程序号格式无法识别,请附带网页反馈',
|
||||
i + 1,
|
||||
);
|
||||
}
|
||||
if (args[1].trim().isEmpty) {
|
||||
throw UndergraduateActivityException(
|
||||
'teacher_missing',
|
||||
'课程活动未提供教师信息,请附带网页反馈',
|
||||
i + 1,
|
||||
);
|
||||
}
|
||||
if (args[5].trim().isEmpty) {
|
||||
throw UndergraduateActivityException(
|
||||
'room_missing',
|
||||
'课程活动未提供教室信息,请附带网页反馈',
|
||||
i + 1,
|
||||
);
|
||||
}
|
||||
final bitmap = args[6];
|
||||
if (!RegExp(r'^0[01]+$').hasMatch(bitmap) ||
|
||||
|
||||
Reference in New Issue
Block a user