Skip to content

Commit

Permalink
Make getCurrentByPerson use performance dates.
Browse files Browse the repository at this point in the history
nb #386, fixes #384
  • Loading branch information
GKFX committed Sep 17, 2018
1 parent 6963637 commit f62809e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Acts/CamdramBundle/Entity/ShowRepository.php
Expand Up @@ -132,12 +132,14 @@ public function getUpcomingByPerson(\DateTime $now, Person $person)
public function getCurrentByPerson(\DateTime $now, Person $person)
{
$query = $this->createQueryBuilder('s')
->where('s.end_at >= :now')
->andWhere('s.start_at < :now')
->andWhere('s.authorised_by is not null')
->join('s.roles', 'r')
->leftJoin('s.performances', 'p')
->where('s.authorised_by is not null')
->andWhere('r.person = :person')
->orderBy('s.start_at', 'ASC')
->orderBy('p.start_date', 'ASC')
->groupBy('s.id')
->having('MIN(p.start_date) < :now')
->andHaving('MAX(p.end_date) >= :now')
->setParameter('person', $person)
->setParameter('now', $now)
->getQuery();
Expand Down

0 comments on commit f62809e

Please sign in to comment.