Skip to content

Commit

Permalink
Guest attempts are tracked now, but will not show up on the leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
aeum1016 committed Mar 20, 2022
1 parent b8979fd commit 93bafb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Home/Game/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ const Game = ({
dispatch(
createAttempt({
...attemptData,
username: user?.result?.username,
email: user?.result?.email,
username: user?.result?.username ? user.result.username : "Guest",
email: user?.result?.email ? user.result.email : "Guest",
time:
attemptData.type === "time"
? Math.floor(attemptData.time)
Expand Down
4 changes: 1 addition & 3 deletions src/components/Leaderboard/Leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ const Leaderboard = () => {

const attempts = useSelector((state) => state.attempts);

console.log(attempts);

attempts.map((attempt) =>
allAttempts.push(
createData(
Expand All @@ -87,7 +85,7 @@ const Leaderboard = () => {

const uniqueUsers = new Set();
function containsUser(a) {
if (!uniqueUsers.has(a.user)) {
if (!uniqueUsers.has(a.user) && a.user != "Guest") {
uniqueUsers.add(a.user);
return false;
}
Expand Down

0 comments on commit 93bafb7

Please sign in to comment.