Fixed the way the number of content in a group is calculated

This commit is contained in:
DrMint 2022-05-15 18:17:01 +02:00
parent d3a349ef17
commit 262d464734
1 changed files with 12 additions and 1 deletions

View File

@ -93,7 +93,18 @@ export default function Contents(props: Immutable<Props>): JSX.Element {
flex flex-row place-items-center gap-2" flex flex-row place-items-center gap-2"
> >
{name} {name}
<Chip>{`${items.length} ${ <Chip>{`${items.reduce((currentSum, item) => {
if (combineRelatedContent) {
if (item.attributes?.group?.data?.attributes?.combine) {
return (
currentSum +
(item.attributes.group.data.attributes.contents?.data
.length ?? 1)
);
}
}
return currentSum + 1;
}, 0)} ${
items.length <= 1 items.length <= 1
? langui.result?.toLowerCase() ?? "" ? langui.result?.toLowerCase() ?? ""
: langui.results?.toLowerCase() ?? "" : langui.results?.toLowerCase() ?? ""