From 5964fa404909550a2dd42a75633fef223fdb05fb Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Mon, 12 Aug 2024 01:23:54 +0900
Subject: feat: do not show preliminary score

---
 frontend/app/components/GolfWatchApp.client.tsx | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

(limited to 'frontend/app/components/GolfWatchApp.client.tsx')

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 =
-- 
cgit v1.2.3-70-g09d2

