Skip to content

Commit

Permalink
Targets > Reports > Target Creation - count mismatch (listed vs expo…
Browse files Browse the repository at this point in the history
…rted) ukwa#695 (in addition pagination fix too - not starting from 0 page after new search)
  • Loading branch information
min2ha committed Dec 7, 2022
1 parent 4c1812d commit 848e67e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/controllers/ReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ public static Result targets(int pageNo, String sortBy, String order, Long curat
public static Result searchCreation() throws ActException {
DynamicForm requestData = form().bindFromRequest();
String action = requestData.get("action");
int pageNo = Integer.parseInt(requestData.get("p"));
String sort = requestData.get("s");
String order = requestData.get("o");
Long curatorId = Long.parseLong(requestData.get("curator"));
Expand Down Expand Up @@ -430,19 +429,19 @@ public static Result searchCreation() throws ActException {
} else {
if (action.equals("export")) {
List<Target> exportTargets = new ArrayList<Target>();
Page<Target> page = Target.pageReportsCreation(pageNo, Const.PAGINATION_OFFSET, sort, order, curatorId, organisationId, startDate, endDate, npld, crawlFrequencyName, tld);
Page<Target> page = Target.pageReportsCreation(0, Const.PAGINATION_OFFSET, sort, order, curatorId, organisationId, startDate, endDate, npld, crawlFrequencyName, tld);

int rowCount = page.getTotalRowCount();

Page<Target> pageAll = Target.pageReportsCreation(pageNo, rowCount, sort, order, curatorId, organisationId, startDate, endDate, npld, crawlFrequencyName, tld);
Page<Target> pageAll = Target.pageReportsCreation(0, rowCount, sort, order, curatorId, organisationId, startDate, endDate, npld, crawlFrequencyName, tld);
exportTargets.addAll(pageAll.getList());
Logger.debug("export report creation size: " + exportTargets.size());
String file = export(exportTargets);
response().setContentType("text/csv; charset=utf-8");
response().setHeader("Content-disposition","attachment; filename=\"" + Const.EXPORT_TARGETS_REPORT_CREATION + "\"");
return ok(file);
} else if (action.equals("search")) {
return redirect(routes.ReportController.targets(pageNo, sort, order, curatorId, organisationId,
return redirect(routes.ReportController.targets(0, sort, order, curatorId, organisationId,
startDate, endDate, npld, crawlFrequencyName, tld));
} else {
return badRequest("This action is not allowed");
Expand Down

0 comments on commit 848e67e

Please sign in to comment.