修复赛事项目组别匹配问题

This commit is contained in:
马梓彭 2026-11-03 15:56:58 +08:00
parent 9f93b742ef
commit 5a42d6ce4c
2 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ namespace YD_Event.Application.Event;
{
private readonly ISqlSugarRepository<EventProject> _eventProjectRepository;
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Project> _projectRepository;
private readonly ISqlSugarRepository<ProjectGroup> _groupRepository;
private readonly ISqlSugarRepository<EventProjectGroup> _eventProjectGroupRepository;
private readonly ISqlSugarRepository<EventRegistrationPerson> _personRepository;
private readonly ISqlSugarRepository<EventRegistration> _registrationRepository;
private readonly ISqlSugarRepository<EventInfo> _eventInfoRepository;
@ -33,7 +33,7 @@ namespace YD_Event.Application.Event;
public EventArrangementService(
ISqlSugarRepository<EventProject> eventProjectRepository,
ISqlSugarRepository<YD_Event.Core.Entities.Project> projectRepository,
ISqlSugarRepository<ProjectGroup> groupRepository,
ISqlSugarRepository<EventProjectGroup> eventProjectGroupRepository,
ISqlSugarRepository<EventRegistrationPerson> personRepository,
ISqlSugarRepository<EventRegistration> registrationRepository,
ISqlSugarRepository<EventInfo> eventInfoRepository,
@ -49,7 +49,7 @@ namespace YD_Event.Application.Event;
{
_eventProjectRepository = eventProjectRepository;
_projectRepository = projectRepository;
_groupRepository = groupRepository;
_eventProjectGroupRepository = eventProjectGroupRepository;
_personRepository = personRepository;
_registrationRepository = registrationRepository;
_eventInfoRepository = eventInfoRepository;
@ -120,7 +120,8 @@ namespace YD_Event.Application.Event;
// 按照 SortIndex 对 projects 排序
var sortedProjects = projects.OrderBy(x => x.SortIndex).ThenBy(x => x.Id).ToList();
var groups = await _groupRepository.GetListAsync(x => projectIds.Contains(x.ProjectId));
var groups = await _eventProjectGroupRepository.GetListAsync(x =>
x.EventId == eventId && projectIds.Contains(x.ProjectId) && !x.DeleteMark);
// 统计各组别报名人数(统计所有非取消状态的报名,并且只统计运动员
var counts = await _personRepository.AsQueryable()
@ -322,7 +323,8 @@ namespace YD_Event.Application.Event;
// 按照 SortIndex 对 projects 排序
var sortedProjects = projects.OrderBy(x => x.SortIndex).ThenBy(x => x.Id).ToList();
var groups = await _groupRepository.GetListAsync(x => projectIds.Contains(x.ProjectId));
var groups = await _eventProjectGroupRepository.GetListAsync(x =>
x.EventId == eventId && projectIds.Contains(x.ProjectId) && !x.DeleteMark);
// 统计各组别报名人数
var counts = await _personRepository.AsQueryable()
@ -637,7 +639,7 @@ namespace YD_Event.Application.Event;
/// </summary>
private static void AssignFreestyleVenues(
List<ArrangementPreviewOutput> entries,
IReadOnlyCollection<ProjectGroup> projectGroups,
IReadOnlyCollection<EventProjectGroup> projectGroups,
int venueCount,
int firstSessionIndex)
{

View File

@ -109,10 +109,8 @@ public partial class WorkbenchController : IDynamicApiController
.Where(e => !e.DeleteMark)
.WhereIF(!string.IsNullOrWhiteSpace(input.EventName), e => e.EventName.Contains(input.EventName!.Trim()));
// 报名平台入口只展示进行中/已结束的赛事;秩序册入口不限制赛事状态
if (mode == "registration")
query = query.Where(e => e.EventStatus == Core.Enum.EventStatus.Ongoing || e.EventStatus == Core.Enum.EventStatus.Ended);
else if (mode != "orderbook")
// 两种数据来源均展示全部未删除赛事,仅校验来源参数是否合法
if (mode != "registration" && mode != "orderbook")
throw Oops.Bah("数据来源只能为registration或orderbook");
return await query.OrderByDescending(e => e.MatchStartTime)