Skip to content

Commit

Permalink
Merge pull request #2 from punktDe/feature/show-entrycount
Browse files Browse the repository at this point in the history
FEATURE: Show the numbers of entries for a form
  • Loading branch information
andrehoffmann30 authored Jun 10, 2020
2 parents d26ef7c + ab00e23 commit 8c345e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Classes/Domain/Repository/FormDataRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ class FormDataRepository extends Repository
public function findAllUniqueForms(): iterable
{
$queryBuilder = $this->createQueryBuilder('form');
$queryBuilder->groupBy('form.formIdentifier')
->addGroupBy('form.hash');
$queryBuilder
->groupBy('form.formIdentifier')
->addGroupBy('form.hash')
->addSelect('count(form) AS entryCount');
return $queryBuilder->getQuery()->execute();
}

Expand Down
16 changes: 11 additions & 5 deletions Resources/Private/Fusion/Controller/Backend/Index.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ prototype(PunktDe.Form.Persistence:Backend.Index) < prototype(Neos.Fusion:Compon
controller = 'Backend\\FormData'
action = 'download'
additionalParams {
formIdentifier = ${formType.formIdentifier}
hash = ${formType.hash}
formIdentifier = ${formType[0].formIdentifier}
hash = ${formType[0].hash}
}
}

date = ${Date.format(formType.date, 'Y-m-d H:i:s')}
date = ${Date.format(formType[0].date, 'Y-m-d H:i:s')}
formObject = ${formType[0]}
entryCount = ${formType.entryCount}

renderer = afx`
<tr>
<td>{formType.formIdentifier}</td>
<td>{formType.hash}</td>
<td>{props.formObject.formIdentifier}</td>
<td>{props.formObject.hash}</td>
<td>{props.entryCount}</td>
<td>{props.date}</td>
<td class="neos-action"><a href={props.downloadLInk} class="neos-button neos-button-primary" title="Export form data as csv"><i class="fas fa-file-download icon-white"></i> Export as CSV</a></td>
</tr>
Expand All @@ -40,6 +43,9 @@ prototype(PunktDe.Form.Persistence:Backend.Index) < prototype(Neos.Fusion:Compon
<th>
Form Version
</th>
<th>
Entry Count
</th>
<th>
Latest Entry
</th>
Expand Down

0 comments on commit 8c345e3

Please sign in to comment.