feat: release undergraduate integration 0.7.0

This commit is contained in:
Codex
2026-10-15 01:14:06 +08:00
parent b28f333720
commit 674df1ceb3
22 changed files with 173 additions and 63 deletions
+2 -1
View File
@@ -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 &&
+2 -1
View File
@@ -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;