补考、缓考成绩自动替换
This commit is contained in:
1 parent
d7d2560587
commit
51b83e9d78
7 files changed
+122
-20
No files matched your search
@@ -55,10 +55,18 @@ public sealed class GradeCalculatorTests
|
||||
|
||||
[Theory]
|
||||
[InlineData(GradeExamStatus.Absent)]
|
||||
[InlineData(GradeExamStatus.Deferred)]
|
||||
[InlineData(GradeExamStatus.Exempt)]
|
||||
public void Exceptional_exam_status_has_no_numeric_total(GradeExamStatus status)
|
||||
{
|
||||
Assert.Null(GradeCalculator.CalculateTotal(90, 90, [], 30, 70, [], status));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deferred_exam_uses_regular_and_final_scores_like_normal_exam()
|
||||
{
|
||||
var total = GradeCalculator.CalculateTotal(
|
||||
83, 91, [], 30, 70, [], GradeExamStatus.Deferred);
|
||||
|
||||
Assert.Equal(88.6m, total);
|
||||
}
|
||||
}
|
||||
@@ -234,6 +234,19 @@ public sealed class TeachingWorkflowRosterTests
|
||||
CancellationToken.None);
|
||||
Assert.IsType<CreatedResult>(gradeResult);
|
||||
Assert.Equal(1, await db.GradeRecords.CountAsync());
|
||||
var originalGradeRecord = await db.GradeRecords.SingleAsync();
|
||||
originalGradeRecord.RegularScore = 80;
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
var deferredExam = new DeferredExam
|
||||
{
|
||||
StudentId = student.Id,
|
||||
TeachingTaskId = task.Id,
|
||||
Reason = "病假",
|
||||
Status = ApprovalStatus.Approved
|
||||
};
|
||||
db.DeferredExams.Add(deferredExam);
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
var makeupPlan = new MakeupExamPlan
|
||||
{
|
||||
@@ -256,7 +269,10 @@ public sealed class TeachingWorkflowRosterTests
|
||||
new MakeupExamEnrollment
|
||||
{
|
||||
StudentId = student.Id,
|
||||
Reason = MakeupReason.Failed
|
||||
Reason = MakeupReason.DeferredApproved,
|
||||
// Simulate an existing deferred-exam enrollment that was
|
||||
// created before SourceGradeRecordId was persisted.
|
||||
SourceDeferredExamId = deferredExam.Id
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -279,6 +295,10 @@ public sealed class TeachingWorkflowRosterTests
|
||||
.Where(x => x.MakeupExamSessionId == makeupSession.Id)
|
||||
.Select(x => x.MakeupScore)
|
||||
.SingleAsync());
|
||||
var replacement = await db.GradeRecords.SingleAsync();
|
||||
Assert.Equal(77, replacement.TotalScore);
|
||||
Assert.Equal(GradeExamStatus.Deferred, replacement.ExamStatus);
|
||||
Assert.Equal("缓考成绩(期末75分,已按正常权重计入平时分)", replacement.Notes);
|
||||
|
||||
var selections = new CourseSelectionsController(db, scope);
|
||||
Assert.Single(ReadItems(await selections.GetMyTeachingTasks(
|
||||
|
||||
Reference in new issue
Block a user