public async Task <IActionResult> FetchTestcase( string prob, int tcid, string filetype, [FromServices] ITestcaseStore testcases) { if (filetype == "input") { filetype = "in"; } else if (filetype == "output") { filetype = "out"; } else { return(NotFound()); } if (TooEarly && !ViewData.ContainsKey("IsJury")) { return(NotFound()); } var problem = Problems.Find(prob); if (problem == null) { return(NotFound()); } var tc = await testcases.FindAsync(problem.ProblemId, tcid); if (tc == null) { return(NotFound()); } if (tc.IsSecret && !problem.Shared) { return(NotFound()); } var file = testcases.GetFile(tc, filetype); if (!file.Exists) { return(NotFound()); } return(File( fileStream: file.CreateReadStream(), contentType: "application/octet-stream", fileDownloadName: $"{problem.ShortName}.t{tcid}.{filetype}")); }
public KattisExportProvider( IProblemStore store, ISubmissionStore submissions, IExecutableStore execs, ITestcaseStore tcs, IMarkdownService markdown, IStaticFileRepository io2) { Store = store; StaticFile = io2; Markdown = markdown; Submissions = submissions; Executables = execs; Testcases = tcs; }
public async Task <IActionResult> Overview(int pid, [FromServices] ITestcaseStore tcs, [FromServices] IArchiveStore archs, [FromServices] IProblemsetStore cps) { ViewBag.TestcaseCount = await tcs.CountAsync(Problem); ViewBag.Archive = await archs.FindInternalAsync(pid); ViewBag.Contests = await cps.ListByProblemAsync(pid); ViewBag.Users = await Problems.ListPermittedUserAsync(pid); return(View(Problem)); }
public async Task <IActionResult> List( [FromServices] ITestcaseStore tcs, int pid, bool all = false, int page = 1) { if (page < 0) { return(NotFound()); } Expression <Func <Submission, bool> > cond = s => s.ProblemId == pid; if (!all) { cond = cond.Combine(s => s.ExpectedResult != null); } var(result, totPage) = await Submissions.ListWithJudgingAsync((page, 30), cond, true); totPage = (totPage - 1) / 30 + 1; if (result.Any()) { var id1 = result.First().SubmissionId; var id2 = result.Last().SubmissionId; if (id1 > id2) { (id1, id2) = (id2, id1); } var cond2 = cond.Combine(s => s.SubmissionId >= id1 && s.SubmissionId <= id2); var names = await Submissions.GetAuthorNamesAsync(cond2); foreach (var item in result) { item.AuthorName = names.GetValueOrDefault(item.SubmissionId, "SYSTEM"); } } ViewBag.TotalPage = totPage; ViewBag.Page = page; ViewBag.AllSub = all; ViewBag.Testcase = await tcs.ListAsync(pid); return(View(result)); }
public TestcasesController(ITestcaseStore store) { Store = store; }
public TestcasesController(ITestcaseStore testcases, IJudgingStore judgings) { Testcases = testcases; Judgings = judgings; }