aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/models/SubmissionResult.ts
blob: 7311494d8729f7baa266fa2da700139e5afd14ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { VerificationResult } from "./VerificationResult";

export type SubmissionResultStatus =
	| "running"
	| "success"
	| "wrong_answer"
	| "timeout"
	| "compile_error"
	| "runtime_error"
	| "internal_error";

export type SubmissionResult = {
	status: SubmissionResultStatus;
	verificationResults: VerificationResult[];
};

export function submissionResultStatusToLabel(
	status: SubmissionResultStatus | null,
) {
	switch (status) {
		case null:
			return "-";
		case "running":
			return "Running...";
		case "success":
			return "Accepted";
		case "wrong_answer":
			return "Wrong Answer";
		case "timeout":
			return "Time Limit Exceeded";
		case "compile_error":
			return "Compile Error";
		case "runtime_error":
			return "Runtime Error";
		case "internal_error":
			return "Internal Error";
	}
}