Compare commits

..

3 commits

Author SHA1 Message Date
Ethan Lane 807c87d424 Fix quantity checker not factoring in entities with 0 count
All checks were successful
Test / build (push) Successful in 9s
2024-07-12 17:33:09 +01:00
Ethan Lane a419513ea3 Merge branch 'develop' into feature/279-series-view-image-grid-2 2024-07-12 17:28:37 +01:00
Ethan Lane 29bb22a819 Update the series list command to say cards instead of x (#296)
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 20s
- Update the /series list command so that it says "cards" instead if "x", for example `39 cards`

#289

Reviewed-on: #296
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-07-12 16:09:26 +01:00
3 changed files with 3 additions and 11 deletions

View file

@ -47,14 +47,6 @@ export default class Inventory extends AppBaseEntity {
return single;
}
public static async ExistsByCardNumberAndUserId(userId: string, cardNumber: string): Promise<boolean> {
const repository = AppDataSource.getRepository(Inventory);
const count = await repository.count({ where: { UserId: userId, CardNumber: cardNumber }});
return count != 0;
}
public static async FetchAllByUserId(userId: string): Promise<Inventory[]> {
const repository = AppDataSource.getRepository(Inventory);

View file

@ -39,9 +39,9 @@ export default class ImageHelper {
const imageData = await Jimp.read(filePath);
if (userId != null) {
const claimed = await Inventory.ExistsByCardNumberAndUserId(userId, card.id);
const claimed = await Inventory.FetchOneByCardNumberAndUserId(userId, card.id);
if (!claimed) {
if (!claimed || claimed.Quantity == 0) {
imageData.greyscale();
}
}

View file

@ -78,7 +78,7 @@ export default class SeriesHelper {
const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage);
const description = seriesOnPage
.map(x => `[${x.id}] ${x.name} (x${x.cards.length})`)
.map(x => `[${x.id}] ${x.name} (${x.cards.length} cards)`)
.join("\n");
const embed = new EmbedBuilder()