use different logic to decide whether mission type filter should be shown

This commit is contained in:
2023-09-11 13:01:43 +02:00
parent 36ca0fcbfc
commit 74645c065b
3 changed files with 43 additions and 37 deletions

View File

@@ -82,7 +82,7 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
return $qb;
}
if (null !== $types && count($types) > 0) {
if (null !== $types && count($types) > 0) {
$qb->andWhere($qb->expr()->in('t.type', ':types'));
$qb->setParameter('types', $types);

View File

@@ -306,4 +306,28 @@ class SingleTaskRepository extends EntityRepository
->add($qb->expr()->isNull('st.endDate'))
->add($qb->expr()->isNull('st.warningInterval'));
}
public function countByDistinctTypes()
{
$qb = $this->createQueryBuilder('st')
->select('COUNT(DISTINCT st.type)');
$this->buildQuery($qb, []);
return (int) $qb
->getQuery()
->getSingleScalarResult();
}
public function findAllTasktypes()
{
$qb = $this->createQueryBuilder('st')
->select('DISTINCT st.type');
$this->buildQuery($qb, []);
return $qb
->getQuery()
->getResult();
}
}