ofuks commented on a change in pull request #770: URL: https://github.com/apache/incubator-dlab/pull/770#discussion_r438266839
########## 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: You use report.isReportHeaderCompletable() method more than 1 time. Suggested to create variable. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@dlab.apache.org For additional commands, e-mail: dev-h...@dlab.apache.org