From ef8e9af28ba648ceae9f2cb4515e57f80891f6f0 Mon Sep 17 00:00:00 2001 From: furo Date: Mon, 8 Nov 2021 06:37:41 +0100 Subject: [PATCH] Remove unused code --- libs/database/wrapper.js | 110 ++------------------------------------- 1 file changed, 4 insertions(+), 106 deletions(-) diff --git a/libs/database/wrapper.js b/libs/database/wrapper.js index c69cf21..d148613 100644 --- a/libs/database/wrapper.js +++ b/libs/database/wrapper.js @@ -1,52 +1,5 @@ import { sqlite, skinDB } from './init.js' import { simpleSanitize } from './searcher.js' -/** - * This function checks if a player exists - * - * @param {string} player The player to check - - * @returns {boolean} Returns a boolean - */ -export function playerExists(player) { - const exists = sqlite.prepare(`SELECT * FROM points WHERE player = ? LIMIT 1`).get(player) - - if(exists) - return true - else - return false -} - -/** - * This function checks if a map exists - * - * @param {string} player The map to check - - * @returns {boolean} Returns a boolean - */ -export function mapExists(map) { - const exists = sqlite.prepare(`SELECT * FROM maps WHERE map = ? LIMIT 1`).get(map) - - if(exists) - return true - else - return false -} - -/** - * This function checks if a map category exists - * - * @param {string} player The category to check - - * @returns {boolean} Returns a boolean - */ - export function categoryExists(category) { - const exists = sqlite.prepare(`SELECT category FROM maps WHERE category = ? LIMIT 1`).get(category) - - if(exists) - return true - else - return false -} /** * This function returns all data pertaining a certain player @@ -98,20 +51,6 @@ export function map(map) { return prettyifyMap(a) } -export function mapCategory(category) { - let output = [] - const maps = sqlite.prepare(` - SELECT * FROM maps WHERE category = ?`).all(category) - - if(!maps) - return undefined - - for(const map of maps) { - output.push(prettyifyMap(map)) - } - return output -} - /** * This function returns all data pertaining to all maps @@ -393,45 +332,7 @@ export function searchMap(query, categories, stars, sortBy, order) { return output } -/* -Europe -/ RUS - Russia -/ GER - Germany -/ NLD - Netherlands -/ TUR - Turkey -/ POL - Poland -/ FRA - France -Asia -/ IND - INDIA -/ SGP - Singapore -/ CHN - China -/ JAP - Japan -/ KOR - South Korea - -South America -/ COL - Columbia -/ ARG - Argentina -/ CHL - Chile -/ BRA - Brazil - -North America -/ CAN - Cananda -/ USA - USA - -Africa -/ ZAF - South Africa - -Middle east -/ KSA/UAE/IRN - -Others -/ CRI - Costa Rica -/ AUS - Australia -/ OLD ranks (NA/EU) -/ UNK - Some bugged ranks - -*/ export function mapToRegion(srv) { if(srv == "RUS" || srv == "GER" || srv == "NLD" || srv == "TUR" || srv == "POL" || srv == "FRA") return "Europe" @@ -469,21 +370,18 @@ export function playerServer(player) { export default { - playerExists, + player, finishedMaps, unfinishedMaps, - player, + leaderboardPoints, + leaderboardRace, + leaderboardTeamrace, map, graphMap, - mapCategory, allMaps, - mapExists, searchMap, - leaderboardRace, - leaderboardTeamrace, - categoryExists, mapToRegion, playerServer,