示例#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,
            }));
        }