예제 #1
0
        public async Task <IActionResult> Detail(
            int pid, int sid, int?jid,
            [FromServices] ILanguageStore langs)
        {
            var s = await Submissions.FindAsync(sid, true);

            if (s == null || s.ProblemId != pid)
            {
                return(NotFound());
            }
            var j = s.Judgings.SingleOrDefault(jj => jid.HasValue ? jj.JudgingId == jid : jj.Active);

            if (j == null)
            {
                return(NotFound());
            }
            var l = await langs.FindAsync(s.Language);

            var det = await Judgings.GetDetailsAsync(pid, j.JudgingId);

            var uname = await Submissions.GetAuthorNameAsync(sid);

            return(View(new ViewSubmissionModel
            {
                SubmissionId = s.SubmissionId,
                ContestId = s.ContestId,
                Status = j.Status,
                ExecuteMemory = j.ExecuteMemory,
                ExecuteTime = j.ExecuteTime,
                Judging = j,
                Expected = s.ExpectedResult,
                JudgingId = j.JudgingId,
                LanguageId = s.Language,
                Time = s.Time,
                SourceCode = s.SourceCode,
                CompileError = j.CompileError,
                CombinedRunCompare = Problem.CombinedRunCompare,
                TimeLimit = Problem.TimeLimit,
                AllJudgings = s.Judgings,
                UserName = uname ?? "SYSTEM",
                Details = det,
                TestcaseNumber = det.Count(),
                Author = s.Author,
                ServerName = j.Server ?? "UNKNOWN",
                LanguageName = l.Name,
                LanguageExternalId = l.Id,
                TimeFactor = l.TimeFactor,
            }));
        }
예제 #2
0
        public async Task <IActionResult> ChangeExpected(int pid, int sid, ChangeExpectedModel model)
        {
            var it = await Submissions.FindAsync(sid);

            if (it == null || it.ProblemId != pid)
            {
                return(NotFound());
            }

            it.ExpectedResult = model.Verdict == -1 ? default(Verdict?) : (Verdict)model.Verdict;
            it.Language       = model.Language;
            await Submissions.UpdateAsync(it);

            return(RedirectToAction(nameof(Detail)));
        }
예제 #3
0
        public async Task <IActionResult> ChangeExpected(
            int pid, int sid,
            [FromServices] ILanguageStore langs)
        {
            var sub = await Submissions.FindAsync(sid);

            if (sub == null || sub.ProblemId != pid)
            {
                return(NotFound());
            }
            ViewBag.Languages = await langs.ListAsync();

            return(Window(new ChangeExpectedModel
            {
                Verdict = !sub.ExpectedResult.HasValue ? -1 : (int)sub.ExpectedResult.Value,
                Language = sub.Language,
            }));
        }
예제 #4
0
        public async Task <IActionResult> RejudgeOne(int pid, int sid)
        {
            var sub = await Submissions.FindAsync(sid);

            if (sub == null || sub.ProblemId != pid)
            {
                return(NotFound());
            }

            if (sub.ContestId != 0)
            {
                StatusMessage = "Error : contest submissions should be rejudged by jury.";
            }
            else
            {
                await Rejudgings.RejudgeAsync(sub, fullTest : true);
            }
            return(RedirectToAction(nameof(Detail)));
        }