This commit is contained in:
parent
0b2e848383
commit
5bfd8baa3f
@ -50,6 +50,7 @@ export default async function Search({ params, searchParams }: Props) {
|
||||
const sort: ScoreSort = (slug[1] as ScoreSort) || "recent"; // The sorting method
|
||||
const page = parseInt(slug[2]) || 1; // The page number
|
||||
const search = searchParamss["search"] || ""; // The search query
|
||||
|
||||
const response = await scoresaberService.lookupPlayer(id, false);
|
||||
if (response == undefined) {
|
||||
// Invalid player id
|
||||
|
@ -74,7 +74,8 @@ export async function trackScoreSaberPlayer(
|
||||
if (
|
||||
foundPlayer.rawPlayer &&
|
||||
foundPlayer.rawPlayer.inactive &&
|
||||
Date.now() - foundPlayer.getked().getTime() > INACTIVE_CHECK_AGAIN_TIME
|
||||
Date.now() - foundPlayer.getLastTracked().getTime() >
|
||||
INACTIVE_CHECK_AGAIN_TIME
|
||||
) {
|
||||
io &&
|
||||
(await io.logger.warn(
|
||||
|
@ -18,7 +18,7 @@ export interface IPlayer extends Document {
|
||||
/**
|
||||
* The last time the player was tracked
|
||||
*/
|
||||
ked: Date;
|
||||
lastTracked: Date;
|
||||
|
||||
/**
|
||||
* The raw player data.
|
||||
@ -33,7 +33,7 @@ export interface IPlayer extends Document {
|
||||
/**
|
||||
* Gets when this player was last tracked.
|
||||
*/
|
||||
getked(): Date;
|
||||
getLastTracked(): Date;
|
||||
|
||||
/**
|
||||
* Gets the history for the given date
|
||||
@ -64,13 +64,13 @@ export interface IPlayer extends Document {
|
||||
// Mongoose Schema definition for Player
|
||||
const PlayerSchema = new Schema<IPlayer>({
|
||||
_id: { type: String, required: true },
|
||||
ked: { type: Date, default: new Date(), required: false },
|
||||
lastTracked: { type: Date, default: new Date(), required: false },
|
||||
rawPlayer: { type: Object, required: false },
|
||||
statisticHistory: { type: Map, default: () => new Map(), required: false },
|
||||
trackedSince: { type: Date, default: new Date(), required: false },
|
||||
});
|
||||
|
||||
PlayerSchema.methods.getked = function (): Date {
|
||||
PlayerSchema.methods.getLastTracked = function (): Date {
|
||||
return this.ked || new Date();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user