Files
Academic-Affairs-System/src/Jiaowu.Api/Infrastructure/Teaching/TeachingTaskHours.cs
T
biss fe508054d0 教学任务按 授课周数 × 周学时 = 课程总学时 双端校验,不匹配会显示具体差额并阻止保存;公共课批量生成同样校验。
排课约束增加课程、教师、学院、授课方式、场地要求、约束状态筛选,并支持批量修改当前筛选结果。
新增“非排时课程”授课方式:不进入自动排课
不占星期、节次和教室
不阻塞课表发布
允许正常选课
在班级课表和学生个人课表中单独展示
2026-07-25 08:18:25 +08:00

22 lines
772 B
C#

using Jiaowu.Api.Domain.Academic;
namespace Jiaowu.Api.Infrastructure.Teaching;
public static class TeachingTaskHours
{
public static int Calculate(int startWeek, int endWeek, int weeklyHours) =>
endWeek < startWeek ? 0 : (endWeek - startWeek + 1) * weeklyHours;
public static string? Validate(
Course course,
int startWeek,
int endWeek,
int weeklyHours)
{
var plannedHours = Calculate(startWeek, endWeek, weeklyHours);
return plannedHours == course.TotalHours
? null
: $"课程“{course.Name}”总学时为 {course.TotalHours};当前第 {startWeek}—{endWeek} 周、每周 {weeklyHours} 学时,共 {plannedHours} 学时。请调整授课周次或周学时。";
}
}