aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/game/hub.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/game/hub.go')
-rw-r--r--backend/game/hub.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/backend/game/hub.go b/backend/game/hub.go
index 97303ec..670b05f 100644
--- a/backend/game/hub.go
+++ b/backend/game/hub.go
@@ -101,8 +101,7 @@ func (hub *gameHub) run() {
hub.broadcastToWatchers(&watcherMessageS2CSubmit{
Type: watcherMessageTypeS2CSubmit,
Data: watcherMessageS2CSubmitPayload{
- PlayerID: message.client.playerID,
- PreliminaryScore: codeSize,
+ PlayerID: message.client.playerID,
},
})
default:
@@ -338,11 +337,19 @@ func (hub *gameHub) processTaskResults() {
})
}
if aggregatedStatus != "running" {
+ var score nullable.Nullable[int]
+ if aggregatedStatus == "success" {
+ codeSize, err := hub.q.GetSubmissionCodeSizeByID(hub.ctx, int32(taskResult.TaskPayload.SubmissionID))
+ if err == nil {
+ score = nullable.NewNullableWithValue(int(codeSize))
+ }
+ }
hub.broadcastToWatchers(&watcherMessageS2CSubmitResult{
Type: watcherMessageTypeS2CSubmitResult,
Data: watcherMessageS2CSubmitResultPayload{
PlayerID: taskResult.TaskPayload.UserID(),
Status: api.GameWatcherMessageS2CSubmitResultPayloadStatus(aggregatedStatus),
+ Score: score,
},
})
}