Skip to content

Commit 7305348

Browse files
committed
Refactor ParticipantsDataService to remove GetAllByContestWithScoresAndProblems and update related query in ContestResultsBusinessService.
1 parent 9d687fe commit 7305348

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

Services/UI/OJS.Services.Ui.Business/Implementations/ContestResultsBusinessService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public async Task<ServiceResult<ContestResultsViewModel>> GetContestResults(int
110110
}
111111

112112
var participants = await this.participantsData
113-
.GetAllByContestWithScoresAndProblems(contestId.Value)
113+
.GetAllOfficialByContest(contestId.Value)
114+
.Include(p => p.Scores)
115+
.ThenInclude(s => s.Problem)
116+
.ThenInclude(p => p.ProblemGroup)
114117
.ToListAsync();
115118

116119
var participantResults = participants

Services/UI/OJS.Services.Ui.Data/IParticipantsDataService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public interface IParticipantsDataService : IDataService<Participant>
1818

1919
IQueryable<Participant> GetAllByUsernameAndContests(string username, IEnumerable<int> contestIds);
2020

21-
IQueryable<Participant> GetAllByContestWithScoresAndProblems(int contestId);
22-
2321
IQueryable<Participant> GetAllOfficialByContest(int contestId);
2422

2523
Task<bool> ExistsByContestByUserAndIsOfficial(int contestId, string userId, bool isOfficial);

Services/UI/OJS.Services.Ui.Data/Implementations/ParticipantsDataService.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public IQueryable<Participant> GetAllByUsernameAndContests(string username, IEnu
4141
public IQueryable<Participant> GetAllByContest(int contestId)
4242
=> this.GetQuery(p => p.ContestId == contestId);
4343

44-
public IQueryable<Participant> GetAllByContestWithScoresAndProblems(int contestId)
45-
=> this.GetAllByContest(contestId)
46-
.Include(p => p.Scores)
47-
.ThenInclude(s => s.Problem)
48-
.ThenInclude(p => p.ProblemGroup);
49-
5044
public IQueryable<Participant> GetAllOfficialByContest(int contestId)
5145
=> this.GetAllByContest(contestId)
5246
.Where(p => p.IsOfficial);

0 commit comments

Comments
 (0)