Skip to content

Commit

Permalink
fix: season in player stats
Browse files Browse the repository at this point in the history
  • Loading branch information
diangogav committed Nov 27, 2024
1 parent 3bc2824 commit 3bd898d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { config } from "./../../../../config/index";
export class PlayerStatsPostgresRepository implements PlayerStatsRepository {
async findByUserIdAndBanListName(userId: string, banListName: string): Promise<PlayerStats> {
const repository = dataSource.getRepository(PlayerStatsEntity);
const playerStatsResponse = await repository.findOneBy({ banListName, userId });
const playerStatsResponse = await repository.findOneBy({
banListName,
userId,
season: config.season,
});
if (!playerStatsResponse) {
return PlayerStats.initialize({
banListName,
Expand All @@ -29,6 +33,7 @@ export class PlayerStatsPostgresRepository implements PlayerStatsRepository {
losses: playerStats.losses,
points: playerStats.points,
userId: playerStats.userId,
season: config.season,
});

await repository.save(playerStatsEntity);
Expand Down

0 comments on commit 3bd898d

Please sign in to comment.