prettiered again

This commit is contained in:
AKCore 2023-06-03 18:18:11 -07:00
parent 120750b42a
commit a809981179
2 changed files with 24 additions and 24 deletions

View File

@ -56,22 +56,22 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] {
]; ];
} }
return []; 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 { function getSessionByCreatorID(creatorId: string): Session | undefined {
@ -101,14 +101,14 @@ function getNewSessionID(): string {
function updateSession(sessionId: string, sessionData: string): boolean { function updateSession(sessionId: string, sessionData: string): boolean {
const session = sessions.find(session => session.sessionId === sessionId); const session = sessions.find(session => session.sessionId === sessionId);
if (!session) return false; if (!session) return false;
try { try {
const updatedData = JSON.parse(sessionData); const updatedData = JSON.parse(sessionData);
Object.assign(session, updatedData); Object.assign(session, updatedData);
return true; return true;
} catch (error) { } catch (error) {
console.error("Invalid JSON string for session update."); console.error("Invalid JSON string for session update.");
return false; return false;
} }
} }
function deleteSession(sessionId: string): boolean { function deleteSession(sessionId: string): boolean {