From cf7c2769e3e85c188392a9b3124d6af504cb3e66 Mon Sep 17 00:00:00 2001 From: Minzkraut Date: Sun, 28 Aug 2022 21:40:52 +0200 Subject: [PATCH] Drop/Rendering: Move stack sorting from rendering to drop --- commands/drop.js | 3 +-- util/rendering.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/commands/drop.js b/commands/drop.js index 23af598..71fa7a2 100644 --- a/commands/drop.js +++ b/commands/drop.js @@ -39,7 +39,7 @@ module.exports = { cards.push(newCard); } - let reply = "You have dropped the following cards: \n"; + cards.sort((a, b) => a.characterId - b.characterId); const row = new ActionRowBuilder(); let deckImage = await Rendering.renderCardStack(cards); @@ -50,7 +50,6 @@ module.exports = { id: card.characterId } }); - reply += `IID: ${card.id} - ID:${card.identifier} \nP: ${card.printNr} Q: ${card.quality} \nC: ${character.name} \n----------\n`; //Add claim button for each card row.addComponents( diff --git a/util/rendering.js b/util/rendering.js index 666253b..f7bdfcb 100644 --- a/util/rendering.js +++ b/util/rendering.js @@ -7,7 +7,6 @@ const { Character } = require('../models'); module.exports = { name: "Rendering", renderCardStack: async function(cards) { - cards.sort((a, b) => a.charcterId - b.charcterId); for (let card of cards) { console.log(`Iterating card ${card.id}`);