fix: use bigint for competition ranking fields and include stream error details in upload handler

This commit is contained in:
sultanbarys 2026-06-15 22:34:20 +05:00
parent 13bc954dfb
commit e4639d4e2c
2 changed files with 9 additions and 8 deletions

View File

@ -1,9 +1,9 @@
CREATE TABLE IF NOT EXISTS competition_ranking_scores (
id bigserial PRIMARY KEY,
pid numeric(10) NOT NULL,
festival_id integer NOT NULL,
score integer NOT NULL,
festival_id bigint NOT NULL,
score bigint NOT NULL,
team_id smallint NOT NULL,
team_score integer NOT NULL,
team_score bigint NOT NULL,
is_first_upload boolean NOT NULL
);

View File

@ -1,6 +1,7 @@
package globals
import (
"fmt"
nex "github.com/PretendoNetwork/nex-go/v2"
ranking "github.com/PretendoNetwork/nex-protocols-go/v2/ranking/splatoon"
)
@ -18,27 +19,27 @@ func UploadCompetitionRankingScore(err error, packet nex.PacketInterface, callID
// Read CompetitionRankingUploadScoreParam data
festivalID, streamErr := parametersStream.ReadUInt32LE()
if streamErr != nil {
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, "Failed to read festival_id")
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, fmt.Sprintf("Failed to read festival_id: %v", streamErr))
}
score, streamErr := parametersStream.ReadUInt32LE()
if streamErr != nil {
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, "Failed to read score")
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, fmt.Sprintf("Failed to read score: %v", streamErr))
}
teamID, streamErr := parametersStream.ReadUInt8()
if streamErr != nil {
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, "Failed to read team_id")
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, fmt.Sprintf("Failed to read team_id: %v", streamErr))
}
teamScore, streamErr := parametersStream.ReadUInt32LE()
if streamErr != nil {
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, "Failed to read team_score")
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, fmt.Sprintf("Failed to read team_score: %v", streamErr))
}
isFirstUpload, streamErr := parametersStream.ReadBool()
if streamErr != nil {
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, "Failed to read is_first_upload")
return nil, nex.NewError(nex.ResultCodes.Core.Unknown, fmt.Sprintf("Failed to read is_first_upload: %v", streamErr))
}
pid := packet.Sender().PID()