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