From 1b9857dfe5cede3697931d6660b6244e17c5066a Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Mon, 8 Jul 2024 17:55:55 +0100 Subject: [PATCH] Add card count onto the series list command (#293) - Add the card count to the series list command - Fixed the series view command showing the card count excluding the current page, due to the splicing logic #289 Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/293 Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/helpers/SeriesHelper.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helpers/SeriesHelper.ts b/src/helpers/SeriesHelper.ts index 32b1405..d818f1a 100644 --- a/src/helpers/SeriesHelper.ts +++ b/src/helpers/SeriesHelper.ts @@ -20,6 +20,7 @@ export default class SeriesHelper { } const totalPages = Math.ceil(series.cards.length / itemsPerPage); + const totalCards = series.cards.length; if (page > totalPages) { AppLogger.LogVerbose("Helpers/SeriesHelper", `Trying to find page greater than what exists for this series. Page: ${page} but there are only ${totalPages} pages`); @@ -36,7 +37,7 @@ export default class SeriesHelper { .setTitle(series.name) .setColor(EmbedColours.Ok) .setDescription(description) - .setFooter({ text: `${series.id} · ${series.cards.length} cards · Page ${page + 1} of ${totalPages}` }); + .setFooter({ text: `${series.id} · ${totalCards} cards · Page ${page + 1} of ${totalPages}` }); const row = new ActionRowBuilder() .addComponents( @@ -72,7 +73,7 @@ export default class SeriesHelper { const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage); const description = seriesOnPage - .map(x => `[${x.id}] ${x.name}`) + .map(x => `[${x.id}] ${x.name} (x${x.cards.length})`) .join("\n"); const embed = new EmbedBuilder() @@ -96,4 +97,4 @@ export default class SeriesHelper { return { embed, row }; } -} \ No newline at end of file +}