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