Add a warning to the logs if an ID is used twice
All checks were successful
Test / build (push) Successful in 2m28s
All checks were successful
Test / build (push) Successful in 2m28s
This commit is contained in:
parent
be2b837d56
commit
876f2c53f5
1 changed files with 7 additions and 0 deletions
|
@ -39,6 +39,13 @@ export default class CardMetadataFunction {
|
||||||
CoreClient.Cards = cardResult.Result!;
|
CoreClient.Cards = cardResult.Result!;
|
||||||
AppLogger.LogInfo("Functions/CardMetadataFunction", `Loaded ${CoreClient.Cards.flatMap(x => x.cards).length} cards to database`);
|
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 {
|
return {
|
||||||
IsSuccess: true,
|
IsSuccess: true,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue