Skip to content

Commit

Permalink
Updated #sub functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
nithin-sudarsan committed Aug 11, 2023
1 parent a2226ce commit 6c89dca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.perfios</groupId>
<artifactId>data-mapper</artifactId>
<!-- updated version-->
<version>1.2.2</version>
<version>1.2.3</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/org/perfios/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static Map<String, Object> transformJson(Map<List<String>,List<String>> transfor
else if (rhs.contains("#mul")){
value = findProduct(json, rhs);
}
else if(rhs.contains("div")){
else if(rhs.contains("#div")){
value = findQuotient(json, rhs);
}
else if (rhs.contains("#default")){
Expand Down Expand Up @@ -215,7 +215,13 @@ else if (value instanceof ArrayList) {
if (areAllNumbers(listValue)) {
// Nested list contains only numbers, calculate the nested sum
double nestedSum = diffNestedNumbers(listValue,diff);
diff -= nestedSum;
if(initial){
diff+=nestedSum;
initial=false;
}
else {
diff=nestedSum;
}
} else {
throw new RuntimeException("All elements in the ArrayList must be numbers");
}
Expand Down

0 comments on commit 6c89dca

Please sign in to comment.