Skip to content

Commit

Permalink
Fix Rule Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Jun 18, 2024
1 parent 058b621 commit 92c7342
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,27 @@ public List<Analysis> addNewTestsToDBForCalculatedTests(
map.put(Integer.valueOf(test.getId()), null);
});
// insert innitial result value
map.put(
Integer.valueOf(resultSet.result.getTestResult().getTest().getId()),
Integer.valueOf(resultSet.result.getId()));
if (resultSet.result.getTestResult().getTest().getId() != null
&& resultSet.result.getId() != null) {
map.put(
Integer.valueOf(resultSet.result.getTestResult().getTest().getId()),
Integer.valueOf(resultSet.result.getId()));
}
calc.setTestResultMap(map);
resultcalculationService.insert(calc);
}

} else {
for (ResultCalculation resultCalculation : resultCalculations) {
resultCalculation
.getTestResultMap()
.put(
Integer.valueOf(resultSet.result.getTestResult().getTest().getId()),
Integer.valueOf(resultSet.result.getId()));
if (resultSet.result.getTestResult().getTest().getId() != null
&& resultSet.result.getId() != null) {
resultCalculation
.getTestResultMap()
.put(
Integer.valueOf(resultSet.result.getTestResult().getTest().getId()),
Integer.valueOf(resultSet.result.getId()));
}

resultcalculationService.update(resultCalculation);
}
}
Expand Down Expand Up @@ -181,7 +188,7 @@ public List<Analysis> addNewTestsToDBForCalculatedTests(
function.append(number).append(" ");
}
} catch (NumberFormatException e) {

}
break;
case MATH_FUNCTION:
Expand Down Expand Up @@ -530,9 +537,18 @@ private Analysis createCalculatedAnalysis(
generatedAnalysis.setSysUserId(systemUserId);
generatedAnalysis.setResultCalculated(resultCalculated);
if (existingAnalysis != null) {
analysisService.update(generatedAnalysis);
try {
analysisService.update(generatedAnalysis);
} catch (Exception e) {
return null;
}

} else {
analysisService.insert(generatedAnalysis);
try {
analysisService.insert(generatedAnalysis);
} catch (Exception e) {
return null;
}
}
if (resultCalculated) {
createInternalNote(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,12 @@ private Optional<Analysis> addReflexTest(
currentAnalysis.setSysUserId(sysUserId);
currentAnalysis.setTriggeredReflex(Boolean.TRUE);

analysisService.insert(newAnalysis);
analysisService.update(currentAnalysis);
try {
analysisService.insert(newAnalysis);
analysisService.update(currentAnalysis);
} catch (Exception e) {
return Optional.empty();
}

List<Note> notes = new ArrayList<>();
notes.add(
Expand Down

0 comments on commit 92c7342

Please sign in to comment.