From a809981179b4630c1556f11c1677710aef16756c Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 18:18:11 -0700 Subject: [PATCH] prettiered again --- src/managers/sessionManager.ts | 46 +++++++++++++++++----------------- src/types/session.ts | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts index 9ac12327..de990f9e 100644 --- a/src/managers/sessionManager.ts +++ b/src/managers/sessionManager.ts @@ -56,22 +56,22 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { ]; } return []; - } else { - const request = sessionIdOrRequest as FindSessionRequest; - const matchingSessions = sessions.filter(session => { - for (const key in request) { - if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) { - return false; - } - } - console.log("Found Matching Sessions:", matchingSessions); - return true; - }); - return matchingSessions.map(session => ({ - createdBy: session.creatorId, - id: session.sessionId - })); } + + const request = sessionIdOrRequest as FindSessionRequest; + const matchingSessions = sessions.filter(session => { + for (const key in request) { + if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) { + return false; + } + } + console.log("Found Matching Sessions:", matchingSessions); + return true; + }); + return matchingSessions.map(session => ({ + createdBy: session.creatorId, + id: session.sessionId + })); } function getSessionByCreatorID(creatorId: string): Session | undefined { @@ -101,14 +101,14 @@ function getNewSessionID(): string { function updateSession(sessionId: string, sessionData: string): boolean { const session = sessions.find(session => session.sessionId === sessionId); if (!session) return false; - try { - const updatedData = JSON.parse(sessionData); - Object.assign(session, updatedData); - return true; - } catch (error) { - console.error("Invalid JSON string for session update."); - return false; - } + try { + const updatedData = JSON.parse(sessionData); + Object.assign(session, updatedData); + return true; + } catch (error) { + console.error("Invalid JSON string for session update."); + return false; + } } function deleteSession(sessionId: string): boolean { diff --git a/src/types/session.ts b/src/types/session.ts index f4c06274..af61fdc3 100644 --- a/src/types/session.ts +++ b/src/types/session.ts @@ -24,4 +24,4 @@ export interface Session { freePublic: number; freePrivate: number; fullReset: number; -} \ No newline at end of file +}