Identify catch-up courses after status changes

This commit is contained in:
biss committed 2026-11-08 15:52:55 +08:00
1 parent 3f8ca29430
commit d513f001b7
5 files changed
+22 -2

No files matched your search

@@ -126,6 +126,10 @@ public sealed class StudentCurriculumController(
.Distinct()
.ToListAsync(cancellationToken);
var currentCourseIdSet = currentCourseIds.ToHashSet();
var interruptedCourseIds = (await (from effect in db.StudentStatusChangeCourseEffects.AsNoTracking()
join task in db.TeachingTasks.AsNoTracking() on effect.TeachingTaskId equals task.Id
where effect.StudentId == student.Id && planCourseIds.Contains(task.CourseId)
select task.CourseId).Distinct().ToListAsync(cancellationToken)).ToHashSet();
var attemptsByCourse = gradeAttempts
.GroupBy(x => x.CourseId)
.ToDictionary(x => x.Key, x => x.OrderByDescending(
@@ -231,6 +235,8 @@ public sealed class StudentCurriculumController(
progress.Evaluation.Status,
progress.Evaluation.HasFailedAttempt,
progress.Evaluation.HasPassedAttempt,
IsCatchUp = interruptedCourseIds.Contains(item.CourseId) &&
!attemptsByCourse.ContainsKey(item.CourseId),
LatestResult = progress.DisplayedAttempt is null
? null
: new
@@ -404,6 +404,17 @@ public sealed class ApprovalsControllerTests
var summary = json.RootElement.GetProperty("plan").GetProperty("summary");
Assert.Equal(0, summary.GetProperty("inProgressCourseCount").GetInt32());
Assert.Equal(0, summary.GetProperty("failedCourseCount").GetInt32());
var course = json.RootElement.GetProperty("plan").GetProperty("modules")[0].GetProperty("courses")[0];
Assert.True(course.GetProperty("isCatchUp").GetBoolean());
fixture.Db.GradeSheets.Add(new GradeSheet { TeachingTaskId = fixture.CurrentTask.Id, Status = GradeSheetStatus.Published,
Records = [new GradeRecord { StudentId = fixture.Student.Id, TotalScore = 55, IsPassed = false, PublishedAt = DateTime.UtcNow }] });
await fixture.Db.SaveChangesAsync();
var failedResponse = Assert.IsType<OkObjectResult>(await controller.GetMine(CancellationToken.None));
using var failedJson = System.Text.Json.JsonDocument.Parse(System.Text.Json.JsonSerializer.Serialize(failedResponse.Value,
new System.Text.Json.JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults.Web)));
var failedCourse = failedJson.RootElement.GetProperty("plan").GetProperty("modules")[0].GetProperty("courses")[0];
Assert.False(failedCourse.GetProperty("isCatchUp").GetBoolean());
Assert.True(failedCourse.GetProperty("hasFailedAttempt").GetBoolean());
}
[Fact]
+1 -1
View File
@@ -246,7 +246,7 @@ export default {
teachingPreferences: {
teacherTitle: 'Teaching course applications', reviewerTitle: 'Teaching eligibility review', teacherDescription: 'Apply for courses you are willing to teach before scheduling. College approval is required before public-course teaching tasks can be assigned.', reviewerDescription: 'Review teacher applications or assign teachers directly. Approved teachers enter the eligible pool for the selected term and course.', apply: 'Apply for course', assign: 'Assign teacher directly', teacher: 'Teacher', selectTermSubject: 'Select term and course', college: 'College', reviewAssign: 'Review or assign directly', academicOffice: 'Academic affairs', mergeAssign: 'Merge classes and assign teacher', scheduling: 'Scheduling', generateTimetable: 'Generate timetable', allTerms: 'All terms', allStatuses: 'All statuses', refresh: 'Refresh', total: '{count} records', applicant: 'Applicant', course: 'Applied course', term: 'Term', statement: 'Application statement', status: 'Status', reviewComment: 'Review comment', actions: 'Actions', withdraw: 'Withdraw', review: 'Review', processed: 'Processed', emptyTeacher: 'No teaching course applications', emptyReviewer: 'No applications awaiting review', submitTitle: 'Apply for a teaching course', proposedCourse: 'Proposed course', statementPlaceholder: 'Describe relevant teaching experience, research interests, or other context', cancel: 'Cancel', submitReview: 'Submit for college review', reviewTitle: 'Review teaching eligibility', teacherStatement: 'Teacher statement', notProvided: 'Not provided', conclusion: 'Decision', approve: 'Approve', reject: 'Reject', confirmReview: 'Confirm review', assignmentTitle: 'Assign teaching eligibility directly', assignmentHint: 'No teacher application is required. Saving immediately grants eligibility for the selected term and course.', teacherPlaceholder: 'Select by employee number or name', courseLabel: 'Course', coursePlaceholder: 'Select by code or name', credits: '{count} credits', assignmentComment: 'Assignment note', assignmentPlaceholder: 'Enter department arrangements, specialization, or other basis', confirmAssign: 'Confirm assignment', statuses: { Pending: 'Pending review', Approved: 'Approved', Rejected: 'Rejected', Withdrawn: 'Withdrawn' }, messages: { selectTermCourse: 'Select a term and course.', submitted: 'Course application submitted for college review.', withdrawConfirm: 'Withdraw the teaching application for “{course}”?', withdrawTitle: 'Withdraw application', approved: 'Application approved.', rejected: 'Application rejected.', selectAll: 'Select a term, teacher, and course.', assigned: 'Teaching eligibility assigned directly.' },
},
statusChangeImpact: { receivingPending: 'Receiving college review pending', receivingReviewed: 'Receiving college reviewed', receivingApprove: 'Receiving college approves', receivingReject: 'Receiving college rejects', majorTransferHint: 'Cross-college transfers require receiving-college review. Course recognition follows university rules.', classTransition: 'Class change', demotionTermHint: 'Incomplete classes exclusive to the original class are removed; shared classes and independent electives are kept.', resumptionTerm: 'Resumption term', resumptionTermHint: 'Takes effect upon approval; classes missed during leave are not automatically added.', serviceDate: 'Enlistment date', serviceDateRequired: 'Select the enlistment date', dischargeDate: 'Discharge date', dischargeDateRequired: 'Select the discharge date', retained: 'Status retained', targetClass: 'Target class', targetClassRequired: 'Select the target class', targetClassHint: 'Select an active class in the original major; a change of major requires separate approval.', affectedTerm: 'First affected term', affectedTermRequired: 'Select the first affected term', affectedTermHint: 'Incomplete courses from this term onward will be removed; valid results will be retained.', courseImpact: 'Course impact preview', courseImpactHint: 'The final review recalculates this list. Unpublished or exceptional results require prior review.', course: 'Teaching class', disposition: 'Disposition', impact: { Remove: 'Remove course', RemoveEmptyGrade: 'Remove course and empty grade row', KeepGrade: 'Keep valid result', ReviewRequired: 'Review grade first' } },
statusChangeImpact: { catchUpFilter: 'Catch-up after status change', catchUpNeeded: 'Missed during a status change; catch-up needed (not a retake)', catchUpInProgress: 'Catch-up in progress (not a retake)', receivingPending: 'Receiving college review pending', receivingReviewed: 'Receiving college reviewed', receivingApprove: 'Receiving college approves', receivingReject: 'Receiving college rejects', majorTransferHint: 'Cross-college transfers require receiving-college review. Course recognition follows university rules.', classTransition: 'Class change', demotionTermHint: 'Incomplete classes exclusive to the original class are removed; shared classes and independent electives are kept.', resumptionTerm: 'Resumption term', resumptionTermHint: 'Takes effect upon approval; classes missed during leave are not automatically added.', serviceDate: 'Enlistment date', serviceDateRequired: 'Select the enlistment date', dischargeDate: 'Discharge date', dischargeDateRequired: 'Select the discharge date', retained: 'Status retained', targetClass: 'Target class', targetClassRequired: 'Select the target class', targetClassHint: 'Select an active class in the original major; a change of major requires separate approval.', affectedTerm: 'First affected term', affectedTermRequired: 'Select the first affected term', affectedTermHint: 'Incomplete courses from this term onward will be removed; valid results will be retained.', courseImpact: 'Course impact preview', courseImpactHint: 'The final review recalculates this list. Unpublished or exceptional results require prior review.', course: 'Teaching class', disposition: 'Disposition', impact: { Remove: 'Remove course', RemoveEmptyGrade: 'Remove course and empty grade row', KeepGrade: 'Keep valid result', ReviewRequired: 'Review grade first' } },
performance: {
title: 'System performance', description: 'Trace response-time costs from API endpoints into the database.', rangeAria: 'Performance report time range', refreshAria: 'Refresh performance report', notConfigured: 'Waiting for a performance data source', unavailable: 'Performance data is unavailable', fallbackNote: 'Business APIs continue operating normally. The report will not fall back to reading the academic business database.', openDashboard: 'Open monitoring platform', sampleConclusion: 'Sample conclusion', requestCount: 'Total requests', endpointP95: 'Endpoint P95', errorRate: '5xx rate', databaseP95: 'Database P95', slowQueries: 'Slow queries', queryFailures: 'Query failures', chartAria: 'Request rate and endpoint P95 trend', noSamples: 'The data source is connected, but no request metrics were received in this time range.', endpointRanking: 'Endpoint latency ranking', endpointMetrics: 'P95 / requests / 5xx', endpointCounts: '{count} requests · {errors} errors', noEndpoints: 'No endpoint metrics in this range.', databaseRanking: 'Database query ranking', databaseMetrics: 'P95 / calls / slow queries', databaseCounts: '{count} calls · {slow} slow', noDatabase: 'No database metrics in this range.', generatedAt: 'Generated {date} · Page data uses a short cache', viewTraces: 'View raw traces', requestsPerSecond: 'Requests / second', requestRate: 'Request rate', ranges: { '15m': '15 minutes', '1h': '1 hour', '24h': '24 hours', '7d': '7 days' }, notes: { waiting: 'Waiting for metric samples', failedDatabase: 'Database command failures detected', serverErrors: 'Server error rate needs attention', slowQueries: 'Queries exceeded the slow-query threshold', healthy: 'No significant anomalies in the current sample window' },
},
Loaded 3 of 5 files, more files were not shown because too many files have changed in this diff. Show more