Skip to content

Commit

Permalink
DDLS-106 & DDLS-122 : Satisfaction feedback data updates (#1512)
Browse files Browse the repository at this point in the history
* DDLS-106 & DDLS-122 : Excluding satisfaction feedback without a report or ndr id & fixing submission of NDR report feedback

* DDLS-106 : Update to the satisfaction analytics query to use the correct orm relation
  • Loading branch information
ndasmoj authored Jan 25, 2024
1 parent e6f6fd8 commit 18c9df3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions api/app/src/Controller/SatisfactionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ public function add(Request $request)
'reportType' => 'notEmpty',
]);

$report = $this->reportRepository->find($data['reportId']);
$satisfaction = $this->satisfactionRepository->findOneBy(['report' => $report]);
if ('ndr' === $data['reportType']) {
$ndr = $this->ndrRepository->find($data['ndrId']);
$satisfaction = $this->satisfactionRepository->findOneBy(['ndr' => $ndr]);
} else {
$report = $this->reportRepository->find($data['reportId']);
$satisfaction = $this->satisfactionRepository->findOneBy(['report' => $report]);
}

if ($satisfaction) {
$satisfaction = $this->updateSatisfactionScore($satisfaction, $data['score'], $data['comments']);
Expand All @@ -85,10 +90,8 @@ public function add(Request $request)
}

if ('ndr' === $data['reportType']) {
$ndr = $this->ndrRepository->find($data['ndrId']);
$satisfaction->setNdr($ndr);
} else {
$report = $this->reportRepository->find($data['reportId']);
$satisfaction->setReport($report);
}

Expand Down
3 changes: 2 additions & 1 deletion api/app/src/Repository/SatisfactionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public function findAllSatisfactionSubmissions(
$query = $entityManager->createQuery(
'SELECT s.id, s.score, s.comments, s.deputyrole, s.reporttype, s.created
FROM App:Satisfaction s
WHERE s.created > :fromDate
WHERE (s.report IS NOT NULL OR s.ndr IS NOT NULL)
AND s.created > :fromDate
AND s.created < :toDate'
)
->setParameters(['fromDate' => $fromDate, 'toDate' => $toDate]);
Expand Down

0 comments on commit 18c9df3

Please sign in to comment.