Skip to content

Commit

Permalink
maybe fix players not tracking?!??!
Browse files Browse the repository at this point in the history
  • Loading branch information
RealFascinated committed Feb 19, 2025
1 parent a1013e2 commit 6f09003
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions projects/backend/src/service/player.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ export class PlayerService {
await player.save();
}

if (playerToken && player.inactive !== playerToken.inactive) {
player.inactive = playerToken.inactive;
await player.save();
}

return player as PlayerDocument;
}

Expand Down Expand Up @@ -372,6 +377,12 @@ export class PlayerService {
Logger.warn(`Player "${foundPlayer.id}" not found on ScoreSaber`);
return;
}

if (playerToken && foundPlayer.inactive !== playerToken.inactive) {
foundPlayer.inactive = playerToken.inactive;
await foundPlayer.save();
}

if (player.inactive) {
Logger.info(`Player "${foundPlayer.id}" is inactive on ScoreSaber`);
return;
Expand Down Expand Up @@ -727,6 +738,10 @@ export class PlayerService {

Logger.info(`Tracking ${leftoverPlayers.length} leftover player statistics...`);
for (const player of leftoverPlayers) {
if (player.inactive) {
Logger.info(`Skipping inactive player, ${player.id}`);
continue;
}
await PlayerService.trackScoreSaberPlayer(player, trackTime);
}

Expand Down
6 changes: 6 additions & 0 deletions projects/common/src/model/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export class Player {
@prop()
public trackReplays?: boolean;

/**
* Whether this player is inactive or not.
*/
@prop()
public inactive?: boolean;

/**
* The date the player was last tracked.
*/
Expand Down

0 comments on commit 6f09003

Please sign in to comment.