fixed a bug in sushilite/getReportResults

This commit is contained in:
myrto.koukouli 2018-08-07 08:01:39 +00:00
parent c69a7d51a8
commit 5b4f9bae51
1 changed files with 4 additions and 2 deletions

View File

@ -85,16 +85,18 @@ public class SushiliteApiImpl implements SushiliteApi {
throw e;
}
// check remote api's response
System.out.println("sushi responded status " + resp.getStatusCode());
// get the items corresponding to the requested page
List<ReportItem> requestedItemList = new ArrayList<>();
if (resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems() != null) {
try {
int totalItems = resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems().size();
int offset = Integer.parseInt(page);
int size = Integer.parseInt(pageSize);
int offset = Integer.parseInt(page)*size;
if (offset <= (totalItems / size) ) {
if (offset < totalItems ) {
int upperIndex = offset+size;
if (upperIndex > totalItems) {
upperIndex = totalItems;