Skip to content

Commit

Permalink
Merge pull request #557 from mozzy11/2.8
Browse files Browse the repository at this point in the history
fix modify order
  • Loading branch information
mozzy11 authored Sep 19, 2023
2 parents 6590163 + 04e5ce7 commit a642823
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/modifyOrder/ModifyOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ function ModifyOrder() {

return (
<>
<div className="orderLegendBody">
<SearchPatientForm
getSelectedPatient={getSelectedPatient}
></SearchPatientForm>
</div>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public List<IdValuePair> getUserTestSections(String systemUserId, String roleId)
return userTestSections;
}
}

@Override
public List<IdValuePair> getUserSampleTypes(String systemUserId, String roleName) {
String resultsRoleId = roleService.getRoleByName(roleName).getId();
Expand All @@ -181,22 +181,26 @@ public List<IdValuePair> getUserSampleTypes(String systemUserId, String roleName
if (testSections != null) {
testSections.forEach(testSection -> testUnitIds.add(Integer.valueOf(testSection.getId())));
}

List<Test> allTests = testService.getTestsByTestSectionIds(testUnitIds);
Set<String> sampleIds = new HashSet<>();
// clear cache to create a fresh Map of testId To TypeOfSample
List<IdValuePair> userSampleTypes = new ArrayList<>();
if (allTests != null ) {
if (allTests != null) {
typeOfSampleService.clearCache();
allTests.forEach(test -> sampleIds.addAll(typeOfSampleService.getTypeOfSampleForTest(test.getId()).stream()
.map(e -> e.getId()).collect(Collectors.toList())));
allTests.forEach(test -> {
List<TypeOfSample> sampleTypes = typeOfSampleService.getTypeOfSampleForTest(test.getId());
if (sampleTypes != null) {
sampleIds.addAll(sampleTypes.stream().map(e -> e.getId()).collect(Collectors.toList()));
}
});

}

sampleIds.forEach( id -> {
sampleIds.forEach(id -> {
TypeOfSample type = typeOfSampleService.get(id);
if(type != null){
userSampleTypes.add(new IdValuePair(type.getId(), type.getLocalizedName()));
if (type != null) {
userSampleTypes.add(new IdValuePair(type.getId(), type.getLocalizedName()));
}
});

Expand Down

0 comments on commit a642823

Please sign in to comment.