实验课现在直接进入普通排课流程,不再要求先到实验排课模块逐个安排。

普通“添加排课”新增“理论课 / 实验课”类型。
自动排课会分别补足理论学时和实验学时。
实验课只能安排到实验室、实训室、机房、语音室等场地。
发布课表时分别校验理论、实验学时;任一未排足都不能发布。
普通课表及 Excel 导出会标注“实验课”。
历史排课保持不变,迁移后默认识别为理论课;后续新建或修订版本时再补充实验课。
This commit is contained in:
2026-08-02 16:54:41 +08:00 Unverified
parent 9d525826ce
commit f0f59419d5
22 changed files with 6488 additions and 266 deletions
@@ -13,7 +13,7 @@ namespace Jiaowu.Api.Tests;
public sealed class SchedulesControllerTests
{
[Fact]
public async Task Manual_entry_rejects_hours_reserved_for_experiments()
public async Task Manual_entry_adds_experiment_hours_to_regular_schedule()
{
await using var connection = new SqliteConnection("Data Source=:memory:");
await connection.OpenAsync();
@@ -33,6 +33,21 @@ public sealed class SchedulesControllerTests
EndDate = new DateOnly(2027, 1, 17)
};
var college = new College { Code = "LAB", Name = "实验学院" };
var campus = new Campus { Code = "LAB-CAMPUS", Name = "实验校区" };
var building = new Building
{
Code = "LAB-BUILDING",
Name = "实验楼",
Campus = campus
};
var laboratory = new Classroom
{
Code = "LAB-201",
Name = "实验室 201",
Building = building,
Capacity = 40,
RoomType = "实验室"
};
var course = new Course
{
Code = "LAB-01",
@@ -71,7 +86,7 @@ public sealed class SchedulesControllerTests
EndWeek = 16,
WeekPattern = WeekPattern.All
});
db.AddRange(term, college, course, task, plan);
db.AddRange(term, college, campus, building, laboratory, course, task, plan);
db.ScheduleTimeSlots.AddRange(
new ScheduleTimeSlot
{
@@ -102,22 +117,22 @@ public sealed class SchedulesControllerTests
plan.Id,
new ScheduleEntryRequest(
task.Id,
null,
2,
laboratory.Id,
2,
1,
1,
1,
16,
WeekPattern.All,
null),
null,
ScheduleEntryKind.Experiment),
CancellationToken.None);
var problem = Assert.IsType<ObjectResult>(result);
var details = Assert.IsType<ValidationProblemDetails>(problem.Value);
Assert.Contains(
"实践学时请在实验管理中安排",
details.Detail);
Assert.Single(await db.ScheduleEntries.ToListAsync());
Assert.IsType<CreatedResult>(result);
var entries = await db.ScheduleEntries.OrderBy(x => x.Kind).ToListAsync();
Assert.Equal(2, entries.Count);
Assert.Equal(ScheduleEntryKind.Experiment, entries[1].Kind);
Assert.Equal(laboratory.Id, entries[1].ClassroomId);
}
[Fact]