feat: offer the questionnaire for placements ended within a rolling window
This commit is contained in:
1 parent
9d0cdd7f52
commit
3c34cfa76a
8 files changed
+65
-55
No files matched your search
@@ -80,8 +80,8 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
* The teamer's placements with a questionnaire still to be submitted - not started, or saved as
|
||||
* a draft: the teamer feedback, and after a bus escort the bus feedback too
|
||||
* (DispositionContext::questionnaires(), spelled out here in DQL). The rules are those of
|
||||
* DispositionVoter::QUESTIONNAIRE - over (today included), on or after go-live, neither called
|
||||
* off nor skip-formalities - so every row shown on the dashboard can be opened.
|
||||
* DispositionVoter::QUESTIONNAIRE - over (today included), on or after $windowStart, neither
|
||||
* called off nor skip-formalities - so every row shown on the dashboard can be opened.
|
||||
*
|
||||
* The responses are joined as arbitrary entities because the association is one-way; the
|
||||
* questionnaire key has to be part of each JOIN condition, or one questionnaire's response
|
||||
@@ -90,7 +90,7 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
* Rows are [0 => Disposition, 'teamerStatus' => ?QuestionnaireResponseStatus,
|
||||
* 'busStatus' => ?QuestionnaireResponseStatus].
|
||||
*/
|
||||
public function getPendingQuestionnaireQuery(Teamer $teamer, \DateTimeImmutable $goLive): Query
|
||||
public function getPendingQuestionnaireQuery(Teamer $teamer, \DateTimeImmutable $windowStart): Query
|
||||
{
|
||||
$qb = $this->createQueryBuilder('disposition');
|
||||
|
||||
@@ -115,7 +115,7 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
$qb->expr()->neq('disposition.status', ':dispositionCalledOff'),
|
||||
$qb->expr()->notIn('assignment.status', ':assignmentStatuses'),
|
||||
$qb->expr()->eq('assignment.skipFormalities', ':skipFormalities'),
|
||||
$qb->expr()->gte('destination.dateTo', ':goLive'),
|
||||
$qb->expr()->gte('destination.dateTo', ':windowStart'),
|
||||
$qb->expr()->lte('destination.dateTo', ':today'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('teamer_response.id'),
|
||||
@@ -138,7 +138,7 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
->setParameter('dispositionCalledOff', Disposition::STATUS_CALLED_OFF)
|
||||
->setParameter('assignmentStatuses', [Assignment::STATUS_CALLED_OFF, Assignment::STATUS_DELETED])
|
||||
->setParameter('skipFormalities', false)
|
||||
->setParameter('goLive', $goLive, Types::DATE_IMMUTABLE)
|
||||
->setParameter('windowStart', $windowStart, Types::DATE_IMMUTABLE)
|
||||
->setParameter('today', new \DateTimeImmutable('today'), Types::DATE_IMMUTABLE)
|
||||
->setParameter('draft', QuestionnaireResponseStatus::DRAFT)
|
||||
->getQuery()
|
||||
@@ -148,7 +148,7 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
/**
|
||||
* @return list<array{disposition: Disposition, draft: bool}>
|
||||
*/
|
||||
public function findPendingQuestionnaireByTeamer(Teamer $teamer, \DateTimeImmutable $goLive): array
|
||||
public function findPendingQuestionnaireByTeamer(Teamer $teamer, \DateTimeImmutable $windowStart): array
|
||||
{
|
||||
return array_map(
|
||||
static fn (array $row): array => [
|
||||
@@ -156,7 +156,7 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
'draft' => QuestionnaireResponseStatus::DRAFT === $row['teamerStatus']
|
||||
|| QuestionnaireResponseStatus::DRAFT === $row['busStatus'],
|
||||
],
|
||||
$this->getPendingQuestionnaireQuery($teamer, $goLive)->getResult(),
|
||||
$this->getPendingQuestionnaireQuery($teamer, $windowStart)->getResult(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user