Skip to content

Commit

Permalink
Implement isInTournament function
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer committed Jan 26, 2024
1 parent b4608ef commit 4826d1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/entities/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export class User {
}

public isInTournament() {
return true; //Todo: Implement later
const joinedTournamentAt = new Date(this.joinedTournamentAt);
const now = new Date();

return (
joinedTournamentAt.getUTCFullYear() === now.getUTCFullYear() &&
joinedTournamentAt.getUTCMonth() === now.getUTCMonth() &&
joinedTournamentAt.getUTCDate() === now.getUTCDate()
);
}
}
3 changes: 2 additions & 1 deletion src/repositories/tournamentGroup.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ export class TournamentGroupRepository {
username: { S: data.username },
},
UpdateExpression:
'SET groupId = :newGroupId, claimedReward = :claimedRewardVal',
'SET groupId = :newGroupId, claimedReward = :claimedRewardVal, joinedTournamentAt = :joinedTournamentAtVal',
ExpressionAttributeValues: {
':newGroupId': { S: data.groupId },
':claimedRewardVal': { BOOL: false },
':joinedTournamentAtVal': { S: new Date().toISOString()},
},
},
},
Expand Down

0 comments on commit 4826d1c

Please sign in to comment.