Remove testing code

This commit is contained in:
furo 2021-11-13 02:34:52 +01:00
parent becbce9273
commit 742a25cde8
4 changed files with 7 additions and 11 deletions

View File

@ -14,8 +14,6 @@ import { generateDB } from './libs/database/generate.js'
import { dbInit } from './libs/database/init.js' import { dbInit } from './libs/database/init.js'
import { getStats, setStat } from './libs/serverStats.js' import { getStats, setStat } from './libs/serverStats.js'
import { downloadEssentialData } from './libs/download/dowload.js' import { downloadEssentialData } from './libs/download/dowload.js'
import { ddnssStart } from './libs/ddnss/handler.js'
import { searchMap } from './libs/database/wrapper.js'
const start = Date.now() const start = Date.now()
const log = initLog("[ MAIN ]") const log = initLog("[ MAIN ]")
@ -52,5 +50,3 @@ const elapsed = Date.now() - start
log(`Took ${elapsed/1000} seconds to start the server!`) log(`Took ${elapsed/1000} seconds to start the server!`)
Server.listen(process.env.PORT ?? 12345, () => log(`Server started and listening on port ${process.env.PORT}.`)) Server.listen(process.env.PORT ?? 12345, () => log(`Server started and listening on port ${process.env.PORT}.`))
console.log(searchMap("", ["Solo"], [0,1,2,3,4,5], "points", "DESC", 1))

View File

@ -322,6 +322,7 @@ export function graphMap(map, player) {
* @param {array} stars Only include maps with a specific amount of stars [1, 5] * @param {array} stars Only include maps with a specific amount of stars [1, 5]
* @param {string} sortBy What to sort after * @param {string} sortBy What to sort after
* @param {string} order "ASC" | "DESC" * @param {string} order "ASC" | "DESC"
* @param {number} page Which page?
* *
* @returns {array} Returns an array of all maps found * @returns {array} Returns an array of all maps found
*/ */
@ -351,10 +352,6 @@ export function searchMap(query, categories, stars, sortBy, order, page) {
output.push(prettyifyMap(map)) output.push(prettyifyMap(map))
} }
console.log(entriesPerPage * (page - 1))
console.log(entriesPerPage * (page))
console.log(maps.length)
return { "pageInfo": pageInfo, "maps": output } return { "pageInfo": pageInfo, "maps": output }
} }

View File

@ -17,7 +17,7 @@ routes.get(
(req, res) => { (req, res) => {
const map = req.query.map ?? "" const map = req.query.map ?? ""
const categories = req.query.categories ? req.query.categories : "Novice,Moderate,Brutal,Insane,Dummy,DDmaX,Oldschool,Solo,Race,Fun" const categories = req.query.categories ? req.query.categories : "Novice,Moderate,Brutal,Insane,Dummy,DDmaX,Oldschool,Solo,Race,Fun"
const stars = req.query.stars ? req.query.stars : "1,2,3,4,5" const stars = req.query.stars ? req.query.stars : "0,1,2,3,4,5"
const sort = req.query.sortBy ? req.query.sortBy : "map" const sort = req.query.sortBy ? req.query.sortBy : "map"
const order = req.query.order === "desc" ? "desc" : "asc" const order = req.query.order === "desc" ? "desc" : "asc"
const page = req.query.page ? req.query.page : "1" const page = req.query.page ? req.query.page : "1"

View File

@ -7,6 +7,9 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<h3> Found: {{ data.maps.pageInfo.mapCount }} Page: {{ data.maps.pageInfo.page }}/{{ data.maps.pageInfo.totalPages }}
<main class="flex-container"> <main class="flex-container">
<form action="/search" method="get" id="search"> <form action="/search" method="get" id="search">
<h1>Search</h1> <h1>Search</h1>