You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by of...@apache.org on 2020/07/02 17:14:09 UTC
[incubator-dlab] branch develop updated: [DLAB-1720] Minor fix for
exploratory report (#808)
This is an automated email from the ASF dual-hosted git repository.
ofuks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push:
new 6af8bce [DLAB-1720] Minor fix for exploratory report (#808)
6af8bce is described below
commit 6af8bce2428bf8ff428c1928a630017a6150ad51
Author: Pavel Papou <pp...@gmail.com>
AuthorDate: Thu Jul 2 13:13:56 2020 -0400
[DLAB-1720] Minor fix for exploratory report (#808)
[DLAB-1720] Minor fix for exploratory report
---
.../com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
index 960efe9..c0b9aa2 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
@@ -140,8 +140,12 @@ public class BillingServiceImpl implements BillingService {
public BillingReport getExploratoryBillingData(String project, String endpoint, String exploratoryName, List<String> compNames) {
List<String> resourceNames = new ArrayList<>(compNames);
resourceNames.add(exploratoryName);
- List<BillingReportLine> billingData = billingDAO.findBillingData(project, endpoint, resourceNames);
- final double sum = billingData.stream().mapToDouble(BillingReportLine::getCost).sum();
+ List<BillingReportLine> billingReportLines = billingDAO.findBillingData(project, endpoint, resourceNames);
+ final double sum = billingReportLines.stream().mapToDouble(BillingReportLine::getCost).sum();
+ List<BillingReportLine> billingData = billingReportLines
+ .stream()
+ .peek(bd -> bd.setCost(BigDecimal.valueOf(bd.getCost()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()))
+ .collect(Collectors.toList());;
final String currency = billingData.stream().map(BillingReportLine::getCurrency).distinct().count() == 1 ? billingData.get(0).getCurrency() : null;
return BillingReport.builder()
.name(exploratoryName)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org