You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dlab.apache.org by GitBox <gi...@apache.org> on 2020/06/11 01:30:12 UTC

[GitHub] [incubator-dlab] ppapou commented on a change in pull request #770: [DLAB -1742] Billing report bug fix

ppapou commented on a change in pull request #770:
URL: https://github.com/apache/incubator-dlab/pull/770#discussion_r438493743



##########
File path: services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/BillingServiceImpl.java
##########
@@ -116,20 +116,20 @@ public BillingReport getBillingReport(UserInfo user, BillingFilter filter) {
                 .usageDateTo(max)
                 .totalCost(new BigDecimal(sum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())
                 .currency(currency)
-                .isFull(isFullReport(user))
+                .isReportHeaderCompletable(hasUserBillingRole(user))
                 .build();
     }
 
     @Override
     public String downloadReport(UserInfo user, BillingFilter filter) {
-        boolean isFull = isFullReport(user);
         BillingReport report = getBillingReport(user, filter);
-        StringBuilder builder = new StringBuilder(BillingUtils.getFirstLine(report.getSbn(), report.getUsageDateFrom(), report.getUsageDateTo()));
-        builder.append(BillingUtils.getHeader(isFull));
+        StringBuilder reportHead = new StringBuilder(BillingUtils.getFirstLine(report.getSbn(), report.getUsageDateFrom(), report.getUsageDateTo()));
+        String stringOfAdjustedHeader = BillingUtils.getHeader(report.isReportHeaderCompletable());
+        reportHead.append(stringOfAdjustedHeader);
         try {
-            report.getReportLines().forEach(r -> builder.append(BillingUtils.printLine(r, isFull)));
-            builder.append(BillingUtils.getTotal(report.getTotalCost(), report.getCurrency()));
-            return builder.toString();
+            report.getReportLines().forEach(r -> reportHead.append(BillingUtils.printLine(r, report.isReportHeaderCompletable())));

Review comment:
       variable has been added




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@dlab.apache.org
For additional commands, e-mail: dev-help@dlab.apache.org