From d513f001b7366ab300fdd69cbaa987bba84d3a57 Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 8 Nov 2026 15:52:55 +0800 Subject: [PATCH] Identify catch-up courses after status changes --- .../Controllers/StudentCurriculumController.cs | 6 ++++++ tests/Jiaowu.Api.Tests/ApprovalsControllerTests.cs | 11 +++++++++++ web/src/i18n/messages/en-US.ts | 2 +- web/src/i18n/messages/zh-CN.ts | 2 +- web/src/views/StudentCurriculumView.vue | 3 +++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Jiaowu.Api/Controllers/StudentCurriculumController.cs b/src/Jiaowu.Api/Controllers/StudentCurriculumController.cs index 216bc65..3c968c4 100644 --- a/src/Jiaowu.Api/Controllers/StudentCurriculumController.cs +++ b/src/Jiaowu.Api/Controllers/StudentCurriculumController.cs @@ -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 diff --git a/tests/Jiaowu.Api.Tests/ApprovalsControllerTests.cs b/tests/Jiaowu.Api.Tests/ApprovalsControllerTests.cs index a3cafd3..101abd1 100644 --- a/tests/Jiaowu.Api.Tests/ApprovalsControllerTests.cs +++ b/tests/Jiaowu.Api.Tests/ApprovalsControllerTests.cs @@ -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(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] diff --git a/web/src/i18n/messages/en-US.ts b/web/src/i18n/messages/en-US.ts index 9dcddeb..53db90a 100644 --- a/web/src/i18n/messages/en-US.ts +++ b/web/src/i18n/messages/en-US.ts @@ -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' }, }, diff --git a/web/src/i18n/messages/zh-CN.ts b/web/src/i18n/messages/zh-CN.ts index d8f008a..b0a3c72 100644 --- a/web/src/i18n/messages/zh-CN.ts +++ b/web/src/i18n/messages/zh-CN.ts @@ -246,7 +246,7 @@ export default { teachingPreferences: { teacherTitle: '授课科目申报', reviewerTitle: '授课资格审核', teacherDescription: '在排课前申报本学期愿意承担的课程,学院审核通过后才能分配公共课教学任务。', reviewerDescription: '审核教师申报,或由学院直接指定教师;通过后进入相应学期和课程的可分配教师池。', apply: '申报课程', assign: '直接分配教师', teacher: '教师', selectTermSubject: '选择学期与科目', college: '学院', reviewAssign: '审核或直接分配', academicOffice: '教务', mergeAssign: '合班并分配教师', scheduling: '排课', generateTimetable: '生成课表', allTerms: '全部学期', allStatuses: '全部状态', refresh: '刷新', total: '共 {count} 条', applicant: '申报教师', course: '申报课程', term: '学期', statement: '申报说明', status: '状态', reviewComment: '审核意见', actions: '操作', withdraw: '撤回', review: '审核', processed: '已处理', emptyTeacher: '尚未申报授课科目', emptyReviewer: '没有待处理的授课申报', submitTitle: '申报授课科目', proposedCourse: '拟授课程', statementPlaceholder: '可填写相关教学经历、研究方向或其他说明', cancel: '取消', submitReview: '提交学院审核', reviewTitle: '审核授课资格', teacherStatement: '教师说明', notProvided: '未填写', conclusion: '审核结论', approve: '通过', reject: '驳回', confirmReview: '确认审核', assignmentTitle: '直接分配授课教师', assignmentHint: '无需教师先申报,保存后立即取得所选学期与课程的授课资格。', teacherPlaceholder: '按工号或姓名选择', courseLabel: '课程', coursePlaceholder: '按编码或名称选择', credits: '{count} 学分', assignmentComment: '分配说明', assignmentPlaceholder: '可填写教研室安排、专业方向等依据', confirmAssign: '确认分配', statuses: { Pending: '待审核', Approved: '已通过', Rejected: '已驳回', Withdrawn: '已撤回' }, messages: { selectTermCourse: '请选择学期和课程。', submitted: '课程申报已提交,等待学院审核。', withdrawConfirm: '撤回“{course}”的授课申报?', withdrawTitle: '撤回申报', approved: '已审核通过。', rejected: '已驳回申报。', selectAll: '请选择学期、教师和课程。', assigned: '授课资格已直接分配。' }, }, - statusChangeImpact: { receivingPending: '转入学院尚未审核', receivingReviewed: '转入学院已审核', receivingApprove: '转入学院同意', receivingReject: '转入学院驳回', majorTransferHint: '跨学院转专业须经转入学院审核,课程认定仍需按学校规定办理。', classTransition: '班级变化', demotionTermHint: '退出原班级独有的未完成教学班;两班共用的教学班和独立选修课保留。', resumptionTerm: '复学生效学期', resumptionTermHint: '批准后立即生效;休学期间落下的教学班不会自动加入名单。', serviceDate: '入伍日期', serviceDateRequired: '请选择入伍日期', dischargeDate: '退役日期', dischargeDateRequired: '请选择退役日期', retained: '保留学籍', targetClass: '目标班级', targetClassRequired: '请选择目标班级', targetClassHint: '请选择原专业的有效班级,跨专业调整需另行审批。', affectedTerm: '受影响起始学期', affectedTermRequired: '请选择受影响起始学期', affectedTermHint: '该学期及之后未完成的课程将退出;已形成有效成绩的课程保留。', courseImpact: '课程影响预览', courseImpactHint: '终审时会重新计算。未发布或异常成绩需先由教务处理。', course: '教学班', disposition: '处理方式', impact: { Remove: '退出课程', RemoveEmptyGrade: '退出课程并移除空白成绩行', KeepGrade: '保留有效成绩', ReviewRequired: '成绩需先处理' } }, + statusChangeImpact: { catchUpFilter: '因异动补修', catchUpNeeded: '因异动落下,待补修(非重修)', catchUpInProgress: '补修中(非重修)', receivingPending: '转入学院尚未审核', receivingReviewed: '转入学院已审核', receivingApprove: '转入学院同意', receivingReject: '转入学院驳回', majorTransferHint: '跨学院转专业须经转入学院审核,课程认定仍需按学校规定办理。', classTransition: '班级变化', demotionTermHint: '退出原班级独有的未完成教学班;两班共用的教学班和独立选修课保留。', resumptionTerm: '复学生效学期', resumptionTermHint: '批准后立即生效;休学期间落下的教学班不会自动加入名单。', serviceDate: '入伍日期', serviceDateRequired: '请选择入伍日期', dischargeDate: '退役日期', dischargeDateRequired: '请选择退役日期', retained: '保留学籍', targetClass: '目标班级', targetClassRequired: '请选择目标班级', targetClassHint: '请选择原专业的有效班级,跨专业调整需另行审批。', affectedTerm: '受影响起始学期', affectedTermRequired: '请选择受影响起始学期', affectedTermHint: '该学期及之后未完成的课程将退出;已形成有效成绩的课程保留。', courseImpact: '课程影响预览', courseImpactHint: '终审时会重新计算。未发布或异常成绩需先由教务处理。', course: '教学班', disposition: '处理方式', impact: { Remove: '退出课程', RemoveEmptyGrade: '退出课程并移除空白成绩行', KeepGrade: '保留有效成绩', ReviewRequired: '成绩需先处理' } }, performance: { title: '系统性能', description: '从接口进入数据库,定位响应时间消耗在哪里。', rangeAria: '性能报表时间范围', refreshAria: '刷新性能报表', notConfigured: '等待连接性能数据源', unavailable: '性能数据暂不可用', fallbackNote: '业务接口继续正常运行;报表不会回退读取教务业务数据库。', openDashboard: '打开监控平台', sampleConclusion: '采样结论', requestCount: '请求总量', endpointP95: '接口 P95', errorRate: '5xx 比例', databaseP95: '数据库 P95', slowQueries: '慢查询', queryFailures: '查询失败', chartAria: '请求速率与接口 P95 趋势图', noSamples: '数据源已连接,但该时间范围内尚未收到请求指标。', endpointRanking: '接口耗时排行', endpointMetrics: 'P95 / 请求量 / 5xx', endpointCounts: '{count} 次 · {errors} 错误', noEndpoints: '该范围内没有接口指标。', databaseRanking: '数据库查询排行', databaseMetrics: 'P95 / 调用量 / 慢查询', databaseCounts: '{count} 次 · {slow} 慢', noDatabase: '该范围内没有数据库指标。', generatedAt: '生成于 {date} · 页面数据采用短时缓存', viewTraces: '查看原始调用链', requestsPerSecond: '请求 / 秒', requestRate: '请求速率', ranges: { '15m': '15 分钟', '1h': '1 小时', '24h': '24 小时', '7d': '7 天' }, notes: { waiting: '等待指标样本', failedDatabase: '存在失败的数据库命令', serverErrors: '服务端错误率需要关注', slowQueries: '存在超过阈值的慢查询', healthy: '当前采样窗口内未见明显异常' }, }, diff --git a/web/src/views/StudentCurriculumView.vue b/web/src/views/StudentCurriculumView.vue index 142c202..ecda9a3 100644 --- a/web/src/views/StudentCurriculumView.vue +++ b/web/src/views/StudentCurriculumView.vue @@ -27,6 +27,7 @@ const visibleModules = computed(() => { .toLowerCase() .includes(normalizedKeyword) const matchesStatus = statusFilter.value === 'All' || + statusFilter.value === 'CatchUp' && course.isCatchUp || statusFilter.value === 'InProgress' && ['InProgress', 'Retaking'].includes(course.status) || statusFilter.value === 'Failed' && @@ -163,6 +164,7 @@ onMounted(load) + {{ t('studentCurriculum.visibleCount', { count: visibleCourseCount }) }} @@ -204,6 +206,7 @@ onMounted(load)
{{ statusLabel(course.status) }} + {{ t(course.status === 'InProgress' ? 'statusChangeImpact.catchUpInProgress' : 'statusChangeImpact.catchUpNeeded') }} {{ resultText(course) }}