mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
Use SQL sort
This commit is contained in:
parent
1992072493
commit
0bc02e808a
@ -40,7 +40,7 @@ module.exports = class TicketManager {
|
|||||||
category = await this.client.prisma.category.findUnique({
|
category = await this.client.prisma.category.findUnique({
|
||||||
include: {
|
include: {
|
||||||
guild: true,
|
guild: true,
|
||||||
questions: true,
|
questions: { orderBy: { order: 'asc' } },
|
||||||
},
|
},
|
||||||
where: { id: Number(categoryId) },
|
where: { id: Number(categoryId) },
|
||||||
});
|
});
|
||||||
@ -192,7 +192,6 @@ module.exports = class TicketManager {
|
|||||||
.setComponents(
|
.setComponents(
|
||||||
category.questions
|
category.questions
|
||||||
.filter(q => q.type === 'TEXT') // TODO: remove this when modals support select menus
|
.filter(q => q.type === 'TEXT') // TODO: remove this when modals support select menus
|
||||||
.sort((a, b) => a.order - b.order)
|
|
||||||
.map(q => {
|
.map(q => {
|
||||||
if (q.type === 'TEXT') {
|
if (q.type === 'TEXT') {
|
||||||
return new ActionRowBuilder()
|
return new ActionRowBuilder()
|
||||||
@ -351,7 +350,6 @@ module.exports = class TicketManager {
|
|||||||
.setColor(category.guild.primaryColour)
|
.setColor(category.guild.primaryColour)
|
||||||
.setFields(
|
.setFields(
|
||||||
category.questions
|
category.questions
|
||||||
.sort((a, b) => a.order - b.order)
|
|
||||||
.map(q => ({
|
.map(q => ({
|
||||||
name: q.label,
|
name: q.label,
|
||||||
value: interaction.fields.getTextInputValue(q.id) || getMessage('ticket.answers.no_value'),
|
value: interaction.fields.getTextInputValue(q.id) || getMessage('ticket.answers.no_value'),
|
||||||
|
Loading…
Reference in New Issue
Block a user