fix results popup being bad after map already started and coord joins
This commit is contained in:
parent
c4d4f6813b
commit
7d12e4d47f
1 changed files with 16 additions and 2 deletions
|
|
@ -103,6 +103,17 @@
|
|||
// Reactive statements
|
||||
$: isAnyPlayerPlaying = matchPlayers.some(player => (player.playState as any) === User_PlayStates.InGame);
|
||||
|
||||
$: if(isAnyPlayerPlaying && currentSong) {
|
||||
matchPlayers
|
||||
.filter(x => x.playState == User_PlayStates.InGame)
|
||||
.forEach(player => {
|
||||
const playerKey = `${player.guid}-${currentSong.beatmap.levelId.toLowerCase()}`;
|
||||
if (!activeSongPlayers.has(playerKey)) {
|
||||
activeSongPlayers.add(playerKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($authTokenStore) {
|
||||
const cleanToken = $authTokenStore.replace('Bearer ', '');
|
||||
client.setAuthToken(cleanToken);
|
||||
|
|
@ -638,20 +649,23 @@
|
|||
newRts.accuracy = calculateAccuracy(rts, map);
|
||||
|
||||
// Check if any players are still playing this song
|
||||
const playersStillPlaying = Array.from(activeSongPlayers)
|
||||
.some(key => key.endsWith(`-${levelId.toLowerCase()}`));
|
||||
const playersStillPlaying = Array.from(activeSongPlayers).some(key => key.endsWith(`-${levelId.toLowerCase()}`));
|
||||
console.log("Players still playing:", playersStillPlaying)
|
||||
|
||||
const completionType = playersStillPlaying
|
||||
? 'Still Awaiting Scores'
|
||||
: 'Completed';
|
||||
console.log("CompletionType", completionType)
|
||||
|
||||
// Find or create the result record
|
||||
const existingRecordIndex = previousMatchResults.findIndex(x =>
|
||||
x.completionType === 'Still Awaiting Scores' &&
|
||||
x.taData.gameplayParameters?.beatmap?.levelId.toUpperCase() === levelId.toUpperCase()
|
||||
);
|
||||
console.log("existingRecordIndex", existingRecordIndex)
|
||||
|
||||
if (existingRecordIndex === -1) {
|
||||
console.log("creating new record")
|
||||
previousMatchResults = [
|
||||
{
|
||||
taData: map.taData,
|
||||
|
|
|
|||
Loading…
Reference in a new issue