成绩扩展
This commit is contained in:
1 parent
3391ac24b6
commit
40110216d6
35 files changed
+9902
-79
No files matched your search
@@ -438,11 +438,12 @@ public sealed class AcademicPlanningController(
|
||||
x.GradeSheet!.TeachingTask!.CourseId,
|
||||
x.GradeSheet.TeachingTask.Course!.Credits,
|
||||
x.TotalScore,
|
||||
x.ExamStatus))
|
||||
x.ExamStatus,
|
||||
x.IsPassed))
|
||||
.ToListAsync(cancellationToken);
|
||||
var passedCourseIds = gradeAttempts
|
||||
.Where(x => StudentCourseProgressRules.IsPassed(
|
||||
new StudentCourseAttemptSnapshot(x.TotalScore, x.ExamStatus)))
|
||||
new StudentCourseAttemptSnapshot(x.TotalScore, x.ExamStatus, x.Passed)))
|
||||
.Select(x => x.CourseId)
|
||||
.Distinct()
|
||||
.ToHashSet();
|
||||
@@ -461,7 +462,8 @@ public sealed class AcademicPlanningController(
|
||||
StudentCourseProgressRules.IsPassed(
|
||||
new StudentCourseAttemptSnapshot(
|
||||
x.TotalScore,
|
||||
x.ExamStatus))))
|
||||
x.ExamStatus,
|
||||
x.Passed))))
|
||||
.Select(group => group.Key)
|
||||
.ToHashSet();
|
||||
var earnedCredits = gradeAttempts
|
||||
@@ -499,7 +501,8 @@ public sealed class AcademicPlanningController(
|
||||
attemptsByCourse.GetValueOrDefault(x.CourseId, [])
|
||||
.Select(attempt => new StudentCourseAttemptSnapshot(
|
||||
attempt.TotalScore,
|
||||
attempt.ExamStatus)),
|
||||
attempt.ExamStatus,
|
||||
attempt.Passed)),
|
||||
inProgressSet.Contains(x.CourseId)).Status);
|
||||
var currentTerm = await db.AcademicTerms.AsNoTracking()
|
||||
.Where(x => x.IsCurrent)
|
||||
@@ -584,7 +587,8 @@ public sealed class AcademicPlanningController(
|
||||
Guid CourseId,
|
||||
decimal Credits,
|
||||
decimal? TotalScore,
|
||||
GradeExamStatus ExamStatus);
|
||||
GradeExamStatus ExamStatus,
|
||||
bool? Passed);
|
||||
|
||||
private sealed record CourseLabel(
|
||||
Guid CourseId,
|
||||
|
||||
@@ -271,6 +271,8 @@ public sealed class ApprovalsController(AppDbContext db, ICurrentUserDataScope s
|
||||
if (record is null) return NotFound();
|
||||
if (record.GradeSheet!.Status != GradeSheetStatus.Published)
|
||||
return ConflictProblem("只能修改已发布的成绩。");
|
||||
if (record.GradeSheet.EvaluationMethod != GradeEvaluationMethod.Percentage)
|
||||
return ConflictProblem("合格制或等级制成绩请通过成绩单退回流程修改最终评价。");
|
||||
var gm = new GradeModification { GradeRecordId = req.GradeRecordId, CurrentScore = record.TotalScore ?? 0, RequestedScore = req.RequestedScore, Reason = req.Reason.Trim(), ApplicantUserId = scope.Current.UserId };
|
||||
db.GradeModifications.Add(gm);
|
||||
await db.SaveChangesAsync(ct);
|
||||
@@ -323,6 +325,7 @@ public sealed class ApprovalsController(AppDbContext db, ICurrentUserDataScope s
|
||||
// Auto-apply: update grade record
|
||||
gm.GradeRecord!.TotalScore = gm.RequestedScore;
|
||||
gm.GradeRecord.GradePoint = GradeCalculator.CalculateGradePoint(gm.RequestedScore);
|
||||
gm.GradeRecord.IsPassed = gm.RequestedScore >= 60;
|
||||
await db.SaveChangesAsync(ct);
|
||||
await NotificationService.SendAsync(
|
||||
db,
|
||||
@@ -425,7 +428,7 @@ public sealed class ApprovalsController(AppDbContext db, ICurrentUserDataScope s
|
||||
record.GradeSheet!.Status == GradeSheetStatus.Published &&
|
||||
record.GradeSheet.TeachingTask!.CourseId ==
|
||||
req.OriginalCourseId &&
|
||||
record.TotalScore < 60,
|
||||
(record.IsPassed == false || record.IsPassed == null && record.TotalScore < 60),
|
||||
ct);
|
||||
var canReplaceOriginal = isAssignedCourse || hasFailedOriginal;
|
||||
if (!canReplaceOriginal)
|
||||
@@ -435,7 +438,7 @@ public sealed class ApprovalsController(AppDbContext db, ICurrentUserDataScope s
|
||||
x.StudentId == sid.Value &&
|
||||
x.GradeSheet!.Status == GradeSheetStatus.Published &&
|
||||
x.GradeSheet.TeachingTask!.CourseId == req.SubstituteCourseId &&
|
||||
x.TotalScore >= 60,
|
||||
(x.IsPassed == true || x.IsPassed == null && x.TotalScore >= 60),
|
||||
ct);
|
||||
if (!hasPassedSubstitute)
|
||||
return ConflictProblem("替代课程必须具有已发布且及格的成绩。");
|
||||
|
||||
@@ -2078,7 +2078,8 @@ public sealed class CourseSelectionsController(
|
||||
.Select(x => new RetakeGradeAttempt(
|
||||
x.GradeSheet!.TeachingTask!.CourseId,
|
||||
x.TotalScore,
|
||||
x.ExamStatus))
|
||||
x.ExamStatus,
|
||||
x.IsPassed))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return attempts
|
||||
@@ -2088,7 +2089,8 @@ public sealed class CourseSelectionsController(
|
||||
var evaluation = StudentCourseProgressRules.Evaluate(
|
||||
group.Select(x => new StudentCourseAttemptSnapshot(
|
||||
x.TotalScore,
|
||||
x.ExamStatus)),
|
||||
x.ExamStatus,
|
||||
x.Passed)),
|
||||
false);
|
||||
return evaluation.HasFailedAttempt && !evaluation.HasPassedAttempt;
|
||||
})
|
||||
@@ -2110,7 +2112,8 @@ public sealed class CourseSelectionsController(
|
||||
x.GradeSheet.TeachingTask.AcademicTermId != targetAcademicTermId)
|
||||
.Select(x => new StudentCourseAttemptSnapshot(
|
||||
x.TotalScore,
|
||||
x.ExamStatus))
|
||||
x.ExamStatus,
|
||||
x.IsPassed))
|
||||
.ToListAsync(cancellationToken);
|
||||
var evaluation = StudentCourseProgressRules.Evaluate(attempts, false);
|
||||
return evaluation.HasFailedAttempt && !evaluation.HasPassedAttempt;
|
||||
@@ -2514,7 +2517,8 @@ public sealed class CourseSelectionsController(
|
||||
private sealed record RetakeGradeAttempt(
|
||||
Guid CourseId,
|
||||
decimal? TotalScore,
|
||||
GradeExamStatus ExamStatus);
|
||||
GradeExamStatus ExamStatus,
|
||||
bool? Passed);
|
||||
|
||||
private sealed record TeacherTeachingTaskInfo(
|
||||
Guid Id,
|
||||
|
||||
Loaded 3 of 35 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user