aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/models/SubmitResult.ts
blob: 403a0db2200379332bb7f60c1cfeefa2e078411e (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
import type { ExecResult } from "./ExecResult";

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

export type SubmitResult = {
	status: SubmitResultStatus;
	execResults: ExecResult[];
};

export function submitResultStatusToLabel(status: SubmitResultStatus | 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";
	}
}