Done ticket GEPAFINBE-221
This commit is contained in:
@@ -2510,8 +2510,8 @@ public class ApplicationEvaluationDao {
|
||||
ApplicationEvaluationEntity evaluationEntity = evaluationEntityOpt.get();
|
||||
String criteriaJson = evaluationEntity.getCriteria();
|
||||
if (criteriaJson != null){
|
||||
Integer totalScore = calculateTotalScore(evaluationEntity.getCriteria());
|
||||
if (totalScore > 40) {
|
||||
BigDecimal totalScore = calculateTotalScore(evaluationEntity.getCriteria());
|
||||
if (totalScore.compareTo(new BigDecimal("40")) > 0) {
|
||||
applicationEntity.setStatus(status.getValue());
|
||||
log.info("Status updated to TECHNICAL_EVALUATION for applicationId: " + applicationId);
|
||||
}
|
||||
@@ -2522,7 +2522,7 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
}
|
||||
|
||||
private Integer calculateTotalScore(String criteriaJson){
|
||||
private BigDecimal calculateTotalScore(String criteriaJson){
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// Convert JSON string to List of Maps
|
||||
@@ -2530,15 +2530,18 @@ public class ApplicationEvaluationDao {
|
||||
});
|
||||
|
||||
// Sum all scores (ignoring null scores)
|
||||
Integer totalScore = criteriaList.stream()
|
||||
.mapToInt(obj -> obj.get("score") != null ? ((Number) obj.get("score")).intValue() : 0)
|
||||
.sum();
|
||||
BigDecimal totalScore = criteriaList.stream()
|
||||
.map(obj -> {
|
||||
Object score = obj.get("score");
|
||||
return score != null ? new BigDecimal(score.toString()) : BigDecimal.ZERO;
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
return totalScore;
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(" Error parsing criteria JSON: {}", e.getMessage());
|
||||
return 0;
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user