Skip to content

Commit

Permalink
修复小组已经AC重复计算bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Smith-Cruise committed Mar 11, 2018
1 parent 80da423 commit 4407be7
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,17 @@ public void saveContestCode(ContestJudgeTask task, ResponseEntity response) {
@Override
public void saveGroupContestCode(GroupJudgeTask task, ResponseEntity response) {
int gid = task.getGid();
saveContestCode(task, response, gid);
boolean isAC = saveContestCode(task, response, gid);

if (isAC) {
return;
}
// 更新组内用户记录
updateGroupUserTimes(task.getGid(), task.getOwner(), response.getResult());
}

private void saveContestCode(ContestJudgeTask task, ResponseEntity response, int gid) {
// 返回是否已经AC
private boolean saveContestCode(ContestJudgeTask task, ResponseEntity response, int gid) {
int pid = task.getPid();
int cid = task.getCid();
int owner = task.getOwner();
Expand Down Expand Up @@ -157,7 +161,7 @@ private void saveContestCode(ContestJudgeTask task, ResponseEntity response, int
}

if (isAC) {
return;
return true;
}

updateContestProblemTimes(cid, pid, result);
Expand All @@ -167,6 +171,7 @@ private void saveContestCode(ContestJudgeTask task, ResponseEntity response, int
if (task.getContestEntity().getOfficial() == 1) {
updateUserTimes(owner, result);
}
return false;
}

private void saveSubmission(String sourceCode, LanguageEnum lang, double time, int memory, ResultEnum result,
Expand Down

0 comments on commit 4407be7

Please sign in to comment.