update countDetail reducer

This commit is contained in:
Ean Milligan 2025-05-06 04:20:29 -04:00
parent b1fce05149
commit 308f897eb7
1 changed files with 9 additions and 10 deletions

View File

@ -25,17 +25,17 @@ export const rollCounter = (rollSet: RollSet[]): CountDetails => {
return countDetails;
};
export const reduceCountDetails = (counts: CountDetails[]): CountDetails => {
return counts.reduce(
(acc, cnt) => {
export const reduceCountDetails = (counts: CountDetails[]): CountDetails =>
counts.reduce(
(acc, cur) => {
loopCountCheck();
return {
total: acc.total + cnt.total,
successful: acc.successful + cnt.successful,
failed: acc.failed + cnt.failed,
rerolled: acc.rerolled + cnt.rerolled,
dropped: acc.dropped + cnt.dropped,
exploded: acc.exploded + cnt.exploded,
total: acc.total + cur.total,
successful: acc.successful + cur.successful,
failed: acc.failed + cur.failed,
rerolled: acc.rerolled + cur.rerolled,
dropped: acc.dropped + cur.dropped,
exploded: acc.exploded + cur.exploded,
};
},
{
@ -47,4 +47,3 @@ export const reduceCountDetails = (counts: CountDetails[]): CountDetails => {
exploded: 0,
},
);
};