Add a warning to the logs if an ID is used twice
All checks were successful
Test / build (push) Successful in 2m28s

This commit is contained in:
Ethan Lane 2024-05-31 17:51:33 +01:00
parent be2b837d56
commit 876f2c53f5

View file

@ -39,6 +39,13 @@ export default class CardMetadataFunction {
CoreClient.Cards = cardResult.Result!;
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
const duplicateCards = CoreClient.Cards.flatMap(x => x.cards)
.filter((card, index, self) => self.findIndex(c => c.id === card.id) !== index);
if (duplicateCards.length > 0) {
AppLogger.LogWarn("Functions/CardMetadataFunction", `Duplicate card ids found: ${duplicateCards.flatMap(x => x.id).join(", ")}`);
}
return {
IsSuccess: true,
};