feat: release undergraduate integration 0.7.0
This commit is contained in:
@@ -107,8 +107,9 @@ class ExamSchedule {
|
||||
? SupportedSchool.uestcGraduate
|
||||
: SupportedSchool.fromId(json['schoolId'] as String);
|
||||
final rawTypes = json['requestedExamTypes'] ?? <int>[];
|
||||
if (rawTypes is! List || rawTypes.any((t) => t is! int || t < 1 || t > 3))
|
||||
if (rawTypes is! List || rawTypes.any((t) => t is! int || t < 1 || t > 3)) {
|
||||
throw const FormatException('考试类型无效');
|
||||
}
|
||||
final types = rawTypes.cast<int>().toSet();
|
||||
SchoolTerm(int.parse(id), school: school);
|
||||
if (school == SupportedSchool.uestcUndergraduate &&
|
||||
|
||||
@@ -39,8 +39,9 @@ class SchoolTerm {
|
||||
}
|
||||
|
||||
void _graduateOnly() {
|
||||
if (school != SupportedSchool.uestcGraduate)
|
||||
if (school != SupportedSchool.uestcGraduate) {
|
||||
throw StateError('本科查询不能使用研究生链接');
|
||||
}
|
||||
}
|
||||
|
||||
Uri get timetableUri {
|
||||
|
||||
@@ -21,8 +21,9 @@ class UndergraduateExamQuery {
|
||||
required this.term,
|
||||
required Set<UndergraduateExamType> types,
|
||||
}) : types = Set.unmodifiable(types) {
|
||||
if (term.school != SupportedSchool.uestcUndergraduate || types.isEmpty)
|
||||
if (term.school != SupportedSchool.uestcUndergraduate || types.isEmpty) {
|
||||
throw ArgumentError('请选择本科学期和考试类型');
|
||||
}
|
||||
}
|
||||
final SchoolTerm term;
|
||||
final Set<UndergraduateExamType> types;
|
||||
|
||||
Reference in New Issue
Block a user