parent
ca6f43d443
commit
b56229e58b
@ -1,8 +1,7 @@
|
|||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { connectMongo } from "@/common/mongo";
|
import { connectMongo } from "@/common/mongo";
|
||||||
import { IPlayer, PlayerModel } from "@/common/schema/player-schema";
|
import { IPlayer, PlayerModel } from "@/common/schema/player-schema";
|
||||||
import { PlayerHistory } from "@/common/player/player-history";
|
import { seedPlayerHistory } from "@/common/player-utils";
|
||||||
import { seedPlayerHistory, sortPlayerHistory } from "@/common/player-utils";
|
|
||||||
import { scoresaberService } from "@/common/service/impl/scoresaber";
|
import { scoresaberService } from "@/common/service/impl/scoresaber";
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
export async function GET(request: NextRequest) {
|
||||||
|
@ -108,7 +108,7 @@ PlayerSchema.methods.getHistoryPrevious = function (amount: number): {
|
|||||||
const toReturn: { [key: string]: PlayerHistory } = {};
|
const toReturn: { [key: string]: PlayerHistory } = {};
|
||||||
const history = sortPlayerHistory(this.getStatisticHistory());
|
const history = sortPlayerHistory(this.getStatisticHistory());
|
||||||
|
|
||||||
for (let [date, stat] of history) {
|
for (const [date, stat] of history) {
|
||||||
const parsedDate = new Date(date);
|
const parsedDate = new Date(date);
|
||||||
if (getDaysAgo(parsedDate) + 1 <= amount) {
|
if (getDaysAgo(parsedDate) + 1 <= amount) {
|
||||||
toReturn[date] = stat;
|
toReturn[date] = stat;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export function useIsMobile() {
|
export function useIsMobile() {
|
||||||
const [isMobile, setIsMobile] = useState(false);
|
const [isMobile, setIsMobile] = useState(false);
|
||||||
|
Reference in New Issue
Block a user