Remove unused code

This commit is contained in:
furo 2021-11-08 06:37:41 +01:00
parent 9f0a78c590
commit ef8e9af28b

View File

@ -1,52 +1,5 @@
import { sqlite, skinDB } from './init.js' import { sqlite, skinDB } from './init.js'
import { simpleSanitize } from './searcher.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 * This function returns all data pertaining a certain player
@ -98,20 +51,6 @@ export function map(map) {
return prettyifyMap(a) 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 * This function returns all data pertaining to all maps
@ -393,45 +332,7 @@ export function searchMap(query, categories, stars, sortBy, order) {
return output 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) { export function mapToRegion(srv) {
if(srv == "RUS" || srv == "GER" || srv == "NLD" || srv == "TUR" || srv == "POL" || srv == "FRA") if(srv == "RUS" || srv == "GER" || srv == "NLD" || srv == "TUR" || srv == "POL" || srv == "FRA")
return "Europe" return "Europe"
@ -469,21 +370,18 @@ export function playerServer(player) {
export default { export default {
playerExists, player,
finishedMaps, finishedMaps,
unfinishedMaps, unfinishedMaps,
player,
leaderboardPoints, leaderboardPoints,
leaderboardRace,
leaderboardTeamrace,
map, map,
graphMap, graphMap,
mapCategory,
allMaps, allMaps,
mapExists,
searchMap, searchMap,
leaderboardRace,
leaderboardTeamrace,
categoryExists,
mapToRegion, mapToRegion,
playerServer, playerServer,