diff --git a/index.js b/index.js index 7efccb5..107d1d4 100644 --- a/index.js +++ b/index.js @@ -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)) \ No newline at end of file +Server.listen(process.env.PORT ?? 12345, () => log(`Server started and listening on port ${process.env.PORT}.`)) \ No newline at end of file diff --git a/libs/database/wrapper.js b/libs/database/wrapper.js index 01cef8c..9bf1cba 100644 --- a/libs/database/wrapper.js +++ b/libs/database/wrapper.js @@ -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 } } diff --git a/routes/routes.js b/routes/routes.js index 2c80b36..7d69fa4 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -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" diff --git a/views/pages/maps.njk b/views/pages/maps.njk index 1cc7be2..93e8158 100644 --- a/views/pages/maps.njk +++ b/views/pages/maps.njk @@ -7,6 +7,9 @@ {% endblock %} {% block body %} + +

Found: {{ data.maps.pageInfo.mapCount }} Page: {{ data.maps.pageInfo.page }}/{{ data.maps.pageInfo.totalPages }} +
+ {% for map in data.maps.maps %} {{ mapComponent.card(map) }}