fix(score): 按场地统计裁判数量而非按项目
This commit is contained in:
@@ -212,7 +212,7 @@ public class MartialMiniController extends BladeController {
|
||||
private void updateAthleteTotalScore(Long athleteId, Long projectId, Long venueId) {
|
||||
try {
|
||||
// 1. 查询该场地的裁判员数量
|
||||
int requiredJudgeCount = getRequiredJudgeCount(projectId);
|
||||
int requiredJudgeCount = getRequiredJudgeCount(venueId);
|
||||
|
||||
// 2. 获取主裁判ID列表
|
||||
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
|
||||
@@ -265,17 +265,16 @@ public class MartialMiniController extends BladeController {
|
||||
* 获取项目应评分的裁判数量(裁判员,不包括主裁判)
|
||||
* 按项目过滤:检查 projects JSON 字段是否包含该项目ID
|
||||
*/
|
||||
private int getRequiredJudgeCount(Long projectId) {
|
||||
if (projectId == null) {
|
||||
private int getRequiredJudgeCount(Long venueId) {
|
||||
if (venueId == null || venueId <= 0) {
|
||||
return 0;
|
||||
}
|
||||
LambdaQueryWrapper<MartialJudgeInvite> judgeQuery = new LambdaQueryWrapper<>();
|
||||
judgeQuery.eq(MartialJudgeInvite::getIsDeleted, 0);
|
||||
judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除主裁判
|
||||
// 按项目过滤:projects字段包含该项目ID
|
||||
judgeQuery.like(MartialJudgeInvite::getProjects, projectId.toString());
|
||||
judgeQuery.eq(MartialJudgeInvite::getVenueId, venueId);
|
||||
judgeQuery.eq(MartialJudgeInvite::getRefereeType, 2); // Only count referees (type=2), exclude chief judge (type=1) and general judge (type=3)
|
||||
List<MartialJudgeInvite> judges = judgeInviteService.list(judgeQuery);
|
||||
// 使用 distinct judge_id 来计算不重复的裁判数量
|
||||
// Use distinct judge_id to count unique judges
|
||||
return (int) judges.stream()
|
||||
.map(MartialJudgeInvite::getJudgeId)
|
||||
.filter(Objects::nonNull)
|
||||
@@ -392,7 +391,7 @@ public class MartialMiniController extends BladeController {
|
||||
.collect(java.util.stream.Collectors.groupingBy(MartialScore::getAthleteId));
|
||||
|
||||
// 4. 获取该场地的应评裁判数量
|
||||
int requiredJudgeCount = getRequiredJudgeCount(projectId);
|
||||
int requiredJudgeCount = getRequiredJudgeCount(venueId);
|
||||
|
||||
// 5. 根据裁判类型处理选手列表
|
||||
List<org.springblade.modules.martial.pojo.vo.MiniAthleteListVO> filteredList;
|
||||
|
||||
Reference in New Issue
Block a user