已把选课的“年级划分”和限制规则补成完整闭环:
选课批次可指定多个适用年级;留空兼容原有“全部年级”。 新增可选的“最多课程门数”,与原有学分上限并行。 年级、门数限制统一作用于学生可见批次、自主选课、候补、管理员代选和自动递补。 普通候选名单遵守年级及行政班范围;强制选课可绕过业务限制,但仍严格遵守管理员学院权限。 管理页面会展示“2026 级 · 最多 6 门 · 最多 30 学分”,名单和候补列表也增加年级列。 新增 MySQL 迁移:[CourseSelectionGradeLimits.cs](E:/jiaowu/src/Jiaowu.Api/Infrastructure/Persistence/Migrations/MySql/20260726180000_CourseSelectionGradeLimits.cs)。
This commit is contained in:
@@ -21,6 +21,16 @@ public static class CourseSelectionRules
|
||||
public static bool SupportsProxyEnrollment(CourseNature nature) =>
|
||||
nature == CourseNature.GeneralRequired;
|
||||
|
||||
public static bool IsGradeEligible(
|
||||
IEnumerable<int> eligibleGrades,
|
||||
int studentGrade) =>
|
||||
!eligibleGrades.Any() || eligibleGrades.Contains(studentGrade);
|
||||
|
||||
public static bool HasReachedCourseLimit(
|
||||
int? maxCourseCount,
|
||||
int selectedCourseCount) =>
|
||||
maxCourseCount.HasValue && selectedCourseCount >= maxCourseCount.Value;
|
||||
|
||||
public static bool RequiresPublishedSchedule(TeachingTaskSchedulingMode schedulingMode) =>
|
||||
schedulingMode == TeachingTaskSchedulingMode.Standard;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user