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 12:52:05 UTC
[incubator-dlab] branch develop updated: [DLAB-1720] Exploratory
Billing report fix (#806)
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 a9b1781 [DLAB-1720] Exploratory Billing report fix (#806)
a9b1781 is described below
commit a9b178130cf5382f40c5141837419048d1537a7f
Author: Pavel Papou <pp...@gmail.com>
AuthorDate: Thu Jul 2 08:51:53 2020 -0400
[DLAB-1720] Exploratory Billing report fix (#806)
[DLAB-1720] Exploratory Billing report fix
---
.../com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java | 5 +----
1 file changed, 1 insertion(+), 4 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 b0ef02f..960efe9 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,10 +140,7 @@ 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)
- .stream()
- .peek(bd -> bd.setCost(BigDecimal.valueOf(bd.getCost()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()))
- .collect(Collectors.toList());
+ List<BillingReportLine> billingData = billingDAO.findBillingData(project, endpoint, resourceNames);
final double sum = billingData.stream().mapToDouble(BillingReportLine::getCost).sum();
final String currency = billingData.stream().map(BillingReportLine::getCurrency).distinct().count() == 1 ? billingData.get(0).getCurrency() : null;
return BillingReport.builder()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org