aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/models/SubmitResult.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/models/SubmitResult.ts')
-rw-r--r--frontend/app/models/SubmitResult.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/frontend/app/models/SubmitResult.ts b/frontend/app/models/SubmitResult.ts
new file mode 100644
index 0000000..403a0db
--- /dev/null
+++ b/frontend/app/models/SubmitResult.ts
@@ -0,0 +1,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";
+ }
+}