aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-12 01:23:54 +0900
committernsfisis <nsfisis@gmail.com>2024-08-12 01:23:54 +0900
commit5964fa404909550a2dd42a75633fef223fdb05fb (patch)
treed282d098690d0a85930d89ff68f47507c0eb5d7c /frontend
parent8c7d882dfa67bcef37a4f39be6f1ca57f160b816 (diff)
downloadiosdc-japan-2024-albatross-5964fa404909550a2dd42a75633fef223fdb05fb.tar.gz
iosdc-japan-2024-albatross-5964fa404909550a2dd42a75633fef223fdb05fb.tar.zst
iosdc-japan-2024-albatross-5964fa404909550a2dd42a75633fef223fdb05fb.zip
feat: do not show preliminary score
Diffstat (limited to 'frontend')
-rw-r--r--frontend/app/.server/api/schema.d.ts4
-rw-r--r--frontend/app/components/GolfWatchApp.client.tsx14
-rw-r--r--frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx7
3 files changed, 10 insertions, 15 deletions
diff --git a/frontend/app/.server/api/schema.d.ts b/frontend/app/.server/api/schema.d.ts
index 2d116b9..157a96f 100644
--- a/frontend/app/.server/api/schema.d.ts
+++ b/frontend/app/.server/api/schema.d.ts
@@ -203,8 +203,6 @@ export interface components {
GameWatcherMessageS2CSubmitPayload: {
/** @example 1 */
player_id: number;
- /** @example 100 */
- preliminary_score: number;
};
GameWatcherMessageS2CExecResult: {
/** @constant */
@@ -239,6 +237,8 @@ export interface components {
* @enum {string}
*/
status: "success" | "wrong_answer" | "timeout" | "runtime_error" | "internal_error" | "compile_error";
+ /** @example 100 */
+ score: number | null;
};
};
responses: {
diff --git a/frontend/app/components/GolfWatchApp.client.tsx b/frontend/app/components/GolfWatchApp.client.tsx
index 448a966..1da2066 100644
--- a/frontend/app/components/GolfWatchApp.client.tsx
+++ b/frontend/app/components/GolfWatchApp.client.tsx
@@ -121,14 +121,13 @@ export default function GolfWatchApp({
player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB;
setter((prev) => ({ ...prev, code }));
} else if (lastJsonMessage.type === "watcher:s2c:submit") {
- const { player_id, preliminary_score } = lastJsonMessage.data;
+ const { player_id } = lastJsonMessage.data;
const setter =
player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB;
setter((prev) => ({
...prev,
submissionResult: {
status: "running",
- preliminaryScore: preliminary_score,
verificationResults: game.verification_steps.map((v) => ({
testcase_id: v.testcase_id,
status: "running",
@@ -165,7 +164,7 @@ export default function GolfWatchApp({
return ret;
});
} else if (lastJsonMessage.type === "watcher:s2c:submitresult") {
- const { player_id, status } = lastJsonMessage.data;
+ const { player_id, status, score } = lastJsonMessage.data;
const setter =
player_id === playerA?.user_id ? setPlayerInfoA : setPlayerInfoB;
setter((prev) => {
@@ -178,11 +177,10 @@ export default function GolfWatchApp({
status,
};
if (status === "success") {
- if (
- ret.score === null ||
- ret.submissionResult.preliminaryScore < ret.score
- ) {
- ret.score = ret.submissionResult.preliminaryScore;
+ if (score) {
+ if (ret.score === null || score < ret.score) {
+ ret.score = score;
+ }
}
} else {
ret.submissionResult.verificationResults =
diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
index 65cd35e..173e8e3 100644
--- a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
+++ b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx
@@ -24,7 +24,6 @@ type SubmissionResult = {
| "compile_error"
| "runtime_error"
| "internal_error";
- preliminaryScore: number;
verificationResults: VerificationResult[];
};
@@ -120,8 +119,7 @@ export default function GolfWatchAppGaming({
<div>
{submissionResultStatusToLabel(
playerInfoA.submissionResult?.status ?? null,
- )}{" "}
- ({playerInfoA.submissionResult?.preliminaryScore})
+ )}
</div>
<div>
<ol>
@@ -153,8 +151,7 @@ export default function GolfWatchAppGaming({
<div>
{submissionResultStatusToLabel(
playerInfoB.submissionResult?.status ?? null,
- )}{" "}
- ({playerInfoB.submissionResult?.preliminaryScore ?? "-"})
+ )}
</div>
<div>
<ol>