use of cn.edu.zjnu.acm.judge.domain.Submission in project judge by zjnu-acm.
the class SubmissionMapperTest method testFindAllByCriteria.
/**
* Test of findAllByCriteria method, of class SubmissionMapper.
*/
@Test
public void testFindAllByCriteria() {
log.info("findAllByCriteria");
SubmissionQueryForm submissionCriteria = SubmissionQueryForm.builder().contest(1058L).problem(1449L).size(50).build();
List<Submission> result = instance.findAllByCriteria(submissionCriteria);
log.info("{}", result.size());
}
use of cn.edu.zjnu.acm.judge.domain.Submission in project judge by zjnu-acm.
the class ShowCompileInfoControllerTest method testShowCompileInfo.
/**
* Test of showCompileInfo method, of class ShowCompileInfoController.
*
* @see ShowCompileInfoController#showCompileInfo(long, Model,
* Authentication)
*/
@Test
public void testShowCompileInfo() throws Exception {
log.info("showCompileInfo");
Submission submission = mockDataService.submission();
MvcResult result = mvc.perform(get("/showcompileinfo").with(user(submission.getUser())).param("solution_id", Long.toString(submission.getId()))).andExpect(status().isOk()).andExpect(view().name("showcompileinfo")).andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML)).andReturn();
}
use of cn.edu.zjnu.acm.judge.domain.Submission in project judge by zjnu-acm.
the class SubmissionService method submit0.
private CompletableFuture<?> submit0(Submission.Builder builder, String source, String userId, int languageId) {
Instant now = Instant.now();
Submission submission = builder.user(userId).inDate(now).sourceLength(source.length()).language(languageId).score(ResultType.QUEUING).build();
// 插入solution数据库表
submissionMapper.save(submission);
long submissionId = submission.getId();
problemMapper.setInDate(submission.getProblem(), now);
// 插入source_code表
submissionMapper.saveSource(submissionId, source);
userPerferenceMapper.setLanguage(userId, languageId);
return judgePool.add(submissionId);
}
use of cn.edu.zjnu.acm.judge.domain.Submission in project judge by zjnu-acm.
the class SubmissionService method bestSubmission.
public Page<Submission> bestSubmission(Long contestId, long problemId, Pageable pageable, long total) {
BestSubmissionForm form = BestSubmissionForm.builder().contestId(contestId).problemId(problemId).build();
List<Submission> bestSubmissions = submissionMapper.bestSubmission(form, pageable);
return new PageImpl<>(bestSubmissions, pageable, total);
}
use of cn.edu.zjnu.acm.judge.domain.Submission in project judge by zjnu-acm.
the class ProblemStatusController method status.
@GetMapping("/problemstatus")
@SuppressWarnings("AssignmentToMethodParameter")
public String status(HttpServletRequest request, @RequestParam("problem_id") long id, @PageableDefault(size = 20, sort = { "time", "memory", "code_length" }) Pageable pageable, Authentication authentication) {
log.debug("{}", pageable);
if (pageable.getPageSize() > 500) {
pageable = new PageRequest(pageable.getPageNumber(), 500, pageable.getSort());
}
Problem problem = problemService.findOneNoI18n(id);
List<ScoreCount> list = submissionMapper.groupByScore(null, id);
ArrayList<String> scores = new ArrayList<>(list.size());
ArrayList<Long> counts = new ArrayList<>(list.size());
ArrayList<String> urls = new ArrayList<>(list.size());
for (ScoreCount scoreCount : list) {
int score = scoreCount.getScore();
scores.add(ResultType.getShowsourceString(score));
counts.add(scoreCount.getCount());
urls.add(request.getContextPath() + "/status?problem_id=" + id + "&score=" + score);
}
Page<Submission> page = submissionService.bestSubmission(null, id, pageable, problem.getSubmitUser());
boolean isAdmin = UserDetailsServiceImpl.isAdminLoginned(request);
boolean isSourceBrowser = UserDetailsServiceImpl.isSourceBrowser(request);
boolean canView = isAdmin || isSourceBrowser;
request.setAttribute("page", page);
request.setAttribute("sa", Arrays.asList(counts, scores, urls));
request.setAttribute("problem", problem);
request.setAttribute("url", URLBuilder.fromRequest(request).replaceQueryParam("page").toString());
request.setAttribute("canView", canView);
request.setAttribute("authentication", authentication);
return "problems/status";
}
Aggregations