fix(我的培训):「我的培训」的“与我相关”判定(学习任务/讲师/部门范围)不含「参加人员」——线下课不生成学习任务,参加人员只落场次名单与文案,刘义亮(资讯组)被课程部门范围(人事课)拦在页签外。
deploy-hxtesting / build-and-deploy (push) Successful in 20m39s

This commit is contained in:
runny committed 2026-11-24 21:22:27 +08:00
1 parent 448fbcdaff
commit 11450bdb96
8 files changed
+167 -2

No files matched your search

@@ -540,6 +540,19 @@ func (r *trainingRepository) CountEnrolledMembersByCourseID(ctx context.Context,
return int(cnt), err
}
// ListMyEnrolledCourseIDs 当前成员经场次学员名单报名的课程 id 去重集合
// (我的培训「我参加」判定数据源)。名单为软删(ReplaceEnrollments 移除即置
// deleted_at),故须过滤 e.deleted_at;场次软删行同样不计。
func (r *trainingRepository) ListMyEnrolledCourseIDs(ctx context.Context, tenantID uint64, memberID string) ([]string, error) {
ids := []string{}
err := r.db.WithContext(ctx).
Table("tr_enrollments e").
Joins("JOIN tr_course_sessions s ON s.id = e.session_id AND s.tenant_id = e.tenant_id AND s.deleted_at IS NULL").
Where("e.tenant_id = ? AND e.member_id = ? AND e.deleted_at IS NULL", tenantID, memberID).
Distinct().Pluck("s.course_id", &ids).Error
return ids, err
}
// CourseStudyStats 按课程聚合签到/线上学习/考试参与成员(去重成员集合):
// 签到走场次联查;学习任务直接带课程;考试支持场次卷与线上自学卷
// (session 为空时经 paper→bank→course 兜底)两条路径。