fix seal contest rank

This commit is contained in:
Himit_ZH 2021-12-28 16:29:20 +08:00
parent 3e8b5d36d3
commit 6e858ab9bc
3 changed files with 6 additions and 12 deletions

View File

@ -262,7 +262,7 @@ public class ContestController {
List<ContestProblemVo> contestProblemList;
boolean isAdmin = isRoot || contest.getAuthor().equals(userRolesVo.getUsername());
// 如果比赛开启封榜
if (contestService.isSealRank(userRolesVo.getUid(), contest, false, isRoot)) {
if (contestService.isSealRank(userRolesVo.getUid(), contest, true, isRoot)) {
contestProblemList = contestProblemService.getContestProblemList(cid, contest.getStartTime(), contest.getEndTime(),
contest.getSealRankTime(), isAdmin, contest.getAuthor());
} else {
@ -356,7 +356,7 @@ public class ContestController {
Date sealRankTime = null;
//封榜时间除超级管理员和比赛管理员外 其它人不可看到最新数据
if (contestService.isSealRank(userRolesVo.getUid(), contest, false, isRoot)) {
if (contestService.isSealRank(userRolesVo.getUid(), contest, true, isRoot)) {
sealRankTime = contest.getSealRankTime();
}
@ -435,7 +435,7 @@ public class ContestController {
Date sealRankTime = null;
// 需要判断是否需要封榜
if (contestService.isSealRank(userRolesVo.getUid(), contest, false, isRoot)) {
if (contestService.isSealRank(userRolesVo.getUid(), contest, true, isRoot)) {
sealRankTime = contest.getSealRankTime();
}
// OI比赛封榜期间不更新ACM比赛封榜期间可看到自己的提交但是其它人的不可见

View File

@ -289,7 +289,7 @@ public class JudgeController {
if (!isRoot && !userRolesVo.getUid().equals(contest.getUid())) {
// 如果是比赛,那么还需要判断是否为封榜,比赛管理员和超级管理员可以有权限查看(ACM题目除外)
if (contest.getType().intValue() == Constants.Contest.TYPE_OI.getCode()
&& contestService.isSealRank(userRolesVo.getUid(), contest, false, false)) {
&& contestService.isSealRank(userRolesVo.getUid(), contest, true, false)) {
result.put("submission", new Judge().setStatus(Constants.Judge.STATUS_SUBMITTED_UNKNOWN_RESULT.getStatus()));
return CommonResult.successResponse(result, "获取提交数据成功!");
}
@ -479,15 +479,10 @@ public class JudgeController {
Contest contest = contestService.getById(submitIdListDto.getCid());
boolean isSealRank = false;
boolean isContestAdmin = isRoot || userRolesVo.getUid().equals(contest.getUid());
// 如果是封榜时间且不是比赛管理员和超级管理员
if (contest.getStatus().intValue() == Constants.Contest.STATUS_RUNNING.getCode() &&
contest.getSealRank() && contest.getSealRankTime().before(new Date()) &&
!isContestAdmin) {
isSealRank = true;
}
boolean isSealRank = contestService.isSealRank(userRolesVo.getUid(), contest, true, isRoot);
QueryWrapper<Judge> queryWrapper = new QueryWrapper<>();
// lambada表达式过滤掉code

View File

@ -166,11 +166,10 @@ public class ProblemController {
HashMap<String, Object> temp = new HashMap<>();
if (pidListDto.getIsContestProblemList()) {
if (!isACMContest) {
if (!result.containsKey(judge.getPid())) { // IO比赛的如果还未写入则使用最新一次提交的结果
// 判断该提交是否为封榜之后的提交,OI赛制封榜后的提交看不到提交结果
// 只有比赛结束可以看到,比赛管理员与超级管理员的提交除外
if (contestService.isSealRank(userRolesVo.getUid(), contest, false,
if (contestService.isSealRank(userRolesVo.getUid(), contest, true,
SecurityUtils.getSubject().hasRole("root"))) {
temp.put("status", Constants.Judge.STATUS_SUBMITTED_UNKNOWN_RESULT.getStatus());
temp.put("score", null);