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
|
// Reactive statements
|
||||||
$: isAnyPlayerPlaying = matchPlayers.some(player => (player.playState as any) === User_PlayStates.InGame);
|
$: 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) {
|
if ($authTokenStore) {
|
||||||
const cleanToken = $authTokenStore.replace('Bearer ', '');
|
const cleanToken = $authTokenStore.replace('Bearer ', '');
|
||||||
client.setAuthToken(cleanToken);
|
client.setAuthToken(cleanToken);
|
||||||
|
|
@ -638,20 +649,23 @@
|
||||||
newRts.accuracy = calculateAccuracy(rts, map);
|
newRts.accuracy = calculateAccuracy(rts, map);
|
||||||
|
|
||||||
// Check if any players are still playing this song
|
// Check if any players are still playing this song
|
||||||
const playersStillPlaying = Array.from(activeSongPlayers)
|
const playersStillPlaying = Array.from(activeSongPlayers).some(key => key.endsWith(`-${levelId.toLowerCase()}`));
|
||||||
.some(key => key.endsWith(`-${levelId.toLowerCase()}`));
|
console.log("Players still playing:", playersStillPlaying)
|
||||||
|
|
||||||
const completionType = playersStillPlaying
|
const completionType = playersStillPlaying
|
||||||
? 'Still Awaiting Scores'
|
? 'Still Awaiting Scores'
|
||||||
: 'Completed';
|
: 'Completed';
|
||||||
|
console.log("CompletionType", completionType)
|
||||||
|
|
||||||
// Find or create the result record
|
// Find or create the result record
|
||||||
const existingRecordIndex = previousMatchResults.findIndex(x =>
|
const existingRecordIndex = previousMatchResults.findIndex(x =>
|
||||||
x.completionType === 'Still Awaiting Scores' &&
|
x.completionType === 'Still Awaiting Scores' &&
|
||||||
x.taData.gameplayParameters?.beatmap?.levelId.toUpperCase() === levelId.toUpperCase()
|
x.taData.gameplayParameters?.beatmap?.levelId.toUpperCase() === levelId.toUpperCase()
|
||||||
);
|
);
|
||||||
|
console.log("existingRecordIndex", existingRecordIndex)
|
||||||
|
|
||||||
if (existingRecordIndex === -1) {
|
if (existingRecordIndex === -1) {
|
||||||
|
console.log("creating new record")
|
||||||
previousMatchResults = [
|
previousMatchResults = [
|
||||||
{
|
{
|
||||||
taData: map.taData,
|
taData: map.taData,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue