Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
### What's done:
 * Renamed `PARTICIPANTS` ContestView tab to `SUMMARY`
 * Renamed `RESULTS` ContestView tab to `SUBMISSIONS`
 * Improved `SUBMISSIONS` tab
 * Added `ContestExecutionView`
 * Added several endpoints on backend for new tab and view

 (#1035)
  • Loading branch information
sanyavertolet committed Aug 22, 2022
1 parent 72547ad commit f96d671
Showing 1 changed file with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,7 @@ class LnkContestProjectController(
@PathVariable organizationName: String,
@PathVariable projectName: String,
authentication: Authentication,
): Flux<ExecutionDto> = Mono.justOrEmpty(contestService.findByName(contestName))
.switchIfEmptyToNotFound {
"Could not find contest with name $contestName."
}
.zipWith(projectService.findByNameAndOrganizationName(projectName, organizationName).toMono())
.switchIfEmptyToNotFound {
"Could not find project with name $organizationName/$projectName."
}
): Flux<ExecutionDto> = getContestAndProject(contestName, organizationName, projectName)
.flatMapMany { (contest, project) ->
lnkContestExecutionService.getPageExecutionsByContestAndProject(
contest,
Expand Down Expand Up @@ -217,14 +210,7 @@ class LnkContestProjectController(
@PathVariable projectName: String,
@PathVariable contestName: String,
authentication: Authentication
): Mono<ExecutionDto> = Mono.justOrEmpty(contestService.findByName(contestName))
.switchIfEmptyToNotFound {
"Could not find contest with name $contestName."
}
.zipWith(projectService.findByNameAndOrganizationName(projectName, organizationName).toMono())
.switchIfEmptyToNotFound {
"Could not find project with name $organizationName/$projectName."
}
): Mono<ExecutionDto> = getContestAndProject(contestName, organizationName, projectName)
.flatMap { (contest, project) ->
lnkContestExecutionService.getLatestExecutionByContestAndProject(contest, project).toMono()
}
Expand All @@ -235,6 +221,15 @@ class LnkContestProjectController(
it.execution.toDto()
}

private fun getContestAndProject(contestName: String, organizationName: String, projectName: String) = Mono.justOrEmpty(contestService.findByName(contestName))
.switchIfEmptyToNotFound {
"Could not find contest with name $contestName."
}
.zipWith(projectService.findByNameAndOrganizationName(projectName, organizationName).toMono())
.switchIfEmptyToNotFound {
"Could not find project with name $organizationName/$projectName."
}

@GetMapping("/{contestName}/enroll")
@PreAuthorize("isAuthenticated()")
@RequiresAuthorizationSourceHeader
Expand Down

0 comments on commit f96d671

Please sign in to comment.