Skip to content

Commit

Permalink
Merge pull request #972 from ao508/pub-update-revisable
Browse files Browse the repository at this point in the history
Publish sample updates when revisable is false
  • Loading branch information
qu8n authored Jun 9, 2023
2 parents e5c7d71 + 0c0700d commit a1f205b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public Boolean updateSampleMetadata(SampleMetadata sampleMetadata, Boolean fromL
sampleMetadata.getIgoRequestId(), sampleMetadata.getPrimaryId());
// new samples may come from IGO_NEW_REQUEST which also invokes this method
// so if a new sample is encountered we should persist it to the database
// a new sample without a existing request will not be persisted
// a new sample without an existing request will not be persisted
if (existingSample == null) {
SmileRequest request = requestService.getSmileRequestById(sampleMetadata.getIgoRequestId());
if (request == null) {
Expand Down Expand Up @@ -247,8 +247,16 @@ public Boolean updateSampleMetadata(SampleMetadata sampleMetadata, Boolean fromL
saveSmileSample(existingSample);
return Boolean.TRUE;
}
// if sample revisable is false then return true so that message handler
// publishes message downstream (allows dashboard to make changes to db directly
// without having to wait or poll for updates)
if (!existingSample.getRevisable()) {
sampleRepository.updateRevisableBySampleId(existingSample.getSmileSampleId(), Boolean.TRUE);
return Boolean.TRUE;
}

// no updates to persist to sample, log and return false
LOG.info("There are no updates to persist for research sample: "
LOG.info("There are no updates to persist for sample: "
+ sampleMetadata.getPrimaryId());
return Boolean.FALSE;
}
Expand Down

0 comments on commit a1f205b

Please sign in to comment.