课程库:保留并验证现有 Excel 导入,支持模板下载、按编码新增/更新、整批校验及事务回滚。
授课资格:学院可直接选择本院教师、学期和课程并分配资格,服务端强制学院数据范围。[后端接口 (line 178)](/E:/jiaowu/src/Jiaowu.Api/Controllers/TeacherCourseApplicationsController.cs:178) · [页面 (line 151)](/E:/jiaowu/web/src/views/TeachingPreferencesView.vue:151) 学生培养方案:新增“我的培养方案”,展示学分进度及已完成、在读、重修中、未通过、待完成、未修读课程,并支持搜索筛选。[学生接口 (line 15)](/E:/jiaowu/src/Jiaowu.Api/Controllers/StudentCurriculumController.cs:15) · [学生页面 (line 88)](/E:/jiaowu/web/src/views/StudentCurriculumView.vue:88)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using Jiaowu.Api.Domain.Academic;
|
||||
using Jiaowu.Api.Infrastructure.Graduation;
|
||||
|
||||
namespace Jiaowu.Api.Tests;
|
||||
|
||||
public sealed class StudentCourseProgressRulesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Passed_attempt_takes_precedence_over_other_states()
|
||||
{
|
||||
var result = StudentCourseProgressRules.Evaluate(
|
||||
[
|
||||
new StudentCourseAttemptSnapshot(52, GradeExamStatus.Normal),
|
||||
new StudentCourseAttemptSnapshot(76, GradeExamStatus.Normal)
|
||||
],
|
||||
true);
|
||||
|
||||
Assert.Equal(StudentCourseProgressStatus.Completed, result.Status);
|
||||
Assert.True(result.HasPassedAttempt);
|
||||
Assert.True(result.HasFailedAttempt);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Failed_course_becomes_retaking_when_currently_in_progress()
|
||||
{
|
||||
var result = StudentCourseProgressRules.Evaluate(
|
||||
[new StudentCourseAttemptSnapshot(48, GradeExamStatus.Normal)],
|
||||
true);
|
||||
|
||||
Assert.Equal(StudentCourseProgressStatus.Retaking, result.Status);
|
||||
Assert.False(result.HasPassedAttempt);
|
||||
Assert.True(result.HasFailedAttempt);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(GradeExamStatus.Absent, StudentCourseProgressStatus.Failed)]
|
||||
[InlineData(GradeExamStatus.Deferred, StudentCourseProgressStatus.Pending)]
|
||||
public void Special_exam_states_are_presented_accurately(
|
||||
GradeExamStatus examStatus,
|
||||
StudentCourseProgressStatus expected)
|
||||
{
|
||||
var result = StudentCourseProgressRules.Evaluate(
|
||||
[new StudentCourseAttemptSnapshot(null, examStatus)],
|
||||
false);
|
||||
|
||||
Assert.Equal(expected, result.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Current_course_without_result_is_in_progress()
|
||||
{
|
||||
var result = StudentCourseProgressRules.Evaluate([], true);
|
||||
|
||||
Assert.Equal(StudentCourseProgressStatus.InProgress, result.Status);
|
||||
Assert.False(result.HasPassedAttempt);
|
||||
Assert.False(result.HasFailedAttempt);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user