Remove testing code

main
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 { getStats, setStat } from './libs/serverStats.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 log = initLog("[ MAIN ]")
@ -51,6 +49,4 @@ Server.use('/assets', express.static('static'))
const elapsed = Date.now() - start
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}.`))
console.log(searchMap("", ["Solo"], [0,1,2,3,4,5], "points", "DESC", 1))
Server.listen(process.env.PORT ?? 12345, () => log(`Server started and listening on port ${process.env.PORT}.`))

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 {string} sortBy What to sort after
* @param {string} order "ASC" | "DESC"
* @param {number} page Which page?
*
* @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))
}
console.log(entriesPerPage * (page - 1))
console.log(entriesPerPage * (page))
console.log(maps.length)
return { "pageInfo": pageInfo, "maps": output }
}

View File

@ -17,7 +17,7 @@ routes.get(
(req, res) => {
const map = req.query.map ?? ""
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 order = req.query.order === "desc" ? "desc" : "asc"
const page = req.query.page ? req.query.page : "1"

View File

@ -7,6 +7,9 @@
{% endblock %}
{% block body %}
<h3> Found: {{ data.maps.pageInfo.mapCount }} Page: {{ data.maps.pageInfo.page }}/{{ data.maps.pageInfo.totalPages }}
<main class="flex-container">
<form action="/search" method="get" id="search">
<h1>Search</h1>
@ -26,7 +29,7 @@
</div>
<button type="submit">Search!</button>
</form>
</form>
{% for map in data.maps.maps %}
{{ mapComponent.card(map) }}