Skip to content

Commit

Permalink
Merge pull request #1615 from all-of-us/aj/hpro-1696/OrderGenerationBugs
Browse files Browse the repository at this point in the history
[HPRO-1696] Don't allow amended measurements in safety check.
  • Loading branch information
Ehaic authored Nov 9, 2023
2 parents 042f62f + 020a12b commit b8ab02b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Repository/MeasurementRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,18 @@ public function getMeasurementsWithoutParent($participantId): array

public function getMostRecentFinalizedNonNullWeight($participantId): Measurement|null
{
$parentIds = $this->createQueryBuilder('m')
->select('m.parentId')
->where('m.parentId is not null')
->andWhere('m.participantId = :participantId')
->setParameter('participantId', $participantId)
->getQuery()
->getResult();
$query = $this->createQueryBuilder('m')
->where('m.participantId = :participantId')
->andWhere('m.finalizedTs is not null')
->andWhere('m.id not in (:parentIds)')
->setParameter('parentIds', $parentIds)
->orderBy('m.finalizedTs', 'DESC')
->leftJoin('m.history', 'mh')
->setParameter('participantId', $participantId);
Expand Down

0 comments on commit b8ab02b

Please sign in to comment.