From 0bc02e808a3ec171d42d6a4a7164a97bcd15c64f Mon Sep 17 00:00:00 2001 From: Isaac Date: Tue, 9 Aug 2022 22:47:24 +0100 Subject: [PATCH] Use SQL sort --- src/lib/tickets/manager.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/tickets/manager.js b/src/lib/tickets/manager.js index b9d2ae7..fa21080 100644 --- a/src/lib/tickets/manager.js +++ b/src/lib/tickets/manager.js @@ -40,7 +40,7 @@ module.exports = class TicketManager { category = await this.client.prisma.category.findUnique({ include: { guild: true, - questions: true, + questions: { orderBy: { order: 'asc' } }, }, where: { id: Number(categoryId) }, }); @@ -192,7 +192,6 @@ module.exports = class TicketManager { .setComponents( category.questions .filter(q => q.type === 'TEXT') // TODO: remove this when modals support select menus - .sort((a, b) => a.order - b.order) .map(q => { if (q.type === 'TEXT') { return new ActionRowBuilder() @@ -351,7 +350,6 @@ module.exports = class TicketManager { .setColor(category.guild.primaryColour) .setFields( category.questions - .sort((a, b) => a.order - b.order) .map(q => ({ name: q.label, value: interaction.fields.getTextInputValue(q.id) || getMessage('ticket.answers.no_value'),