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; return countDetails;
}; };
export const reduceCountDetails = (counts: CountDetails[]): CountDetails => { export const reduceCountDetails = (counts: CountDetails[]): CountDetails =>
return counts.reduce( counts.reduce(
(acc, cnt) => { (acc, cur) => {
loopCountCheck(); loopCountCheck();
return { return {
total: acc.total + cnt.total, total: acc.total + cur.total,
successful: acc.successful + cnt.successful, successful: acc.successful + cur.successful,
failed: acc.failed + cnt.failed, failed: acc.failed + cur.failed,
rerolled: acc.rerolled + cnt.rerolled, rerolled: acc.rerolled + cur.rerolled,
dropped: acc.dropped + cnt.dropped, dropped: acc.dropped + cur.dropped,
exploded: acc.exploded + cnt.exploded, exploded: acc.exploded + cur.exploded,
}; };
}, },
{ {
@ -47,4 +47,3 @@ export const reduceCountDetails = (counts: CountDetails[]): CountDetails => {
exploded: 0, exploded: 0,
}, },
); );
};