This commit is contained in:
parent
038272182a
commit
2e07c31e59
@ -163,6 +163,7 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
|
|||||||
|
|
||||||
const players = usePlayerScoresStore.getState().players;
|
const players = usePlayerScoresStore.getState().players;
|
||||||
const friends = useSettingsStore.getState().friends;
|
const friends = useSettingsStore.getState().friends;
|
||||||
|
if (players.length == 0) {
|
||||||
for (const friend of friends) {
|
for (const friend of friends) {
|
||||||
players.push({
|
players.push({
|
||||||
id: friend.id,
|
id: friend.id,
|
||||||
@ -171,8 +172,6 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (players.length == 0) {
|
|
||||||
toast.info(
|
toast.info(
|
||||||
"Scores database was empty, adding your profile and friends to it",
|
"Scores database was empty, adding your profile and friends to it",
|
||||||
);
|
);
|
||||||
@ -185,6 +184,8 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
|
|||||||
await usePlayerScoresStore.getState().addPlayer(userId);
|
await usePlayerScoresStore.getState().addPlayer(userId);
|
||||||
}
|
}
|
||||||
for (const friend of friends) {
|
for (const friend of friends) {
|
||||||
|
if (usePlayerScoresStore.getState().exists(friend.id)) continue;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Friend ${friend.name} was not found in the scores database, adding them...`,
|
`Friend ${friend.name} was not found in the scores database, adding them...`,
|
||||||
);
|
);
|
||||||
@ -206,6 +207,7 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mostRecentScore = oldScores[0].score;
|
const mostRecentScore = oldScores[0].score;
|
||||||
|
if (mostRecentScore == undefined) continue;
|
||||||
let search = true;
|
let search = true;
|
||||||
|
|
||||||
let page = 0;
|
let page = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user