Skip to content

Commit

Permalink
Adapting /groupBy/tag csv response (#33)
Browse files Browse the repository at this point in the history
an empty result is given if no feature matches the filter
closes #25
  • Loading branch information
bonaparten committed Aug 27, 2020
1 parent a8856c9 commit ec4bacf
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,17 @@ public void writeCsvResponse(GroupByObject[] resultSet, HttpServletResponse serv
CSVWriter writer = writeComments(servletResponse, comments);
Pair<List<String>, List<String[]>> rows;
if (resultSet instanceof GroupByResult[]) {
GroupByResult result = (GroupByResult) resultSet[0];
if (result.getResult() instanceof UsersResult[]) {
rows = createCsvResponseForUsersGroupBy(resultSet);
if (resultSet.length == 0) {
writer.writeNext(new String[] {"timestamp"}, false);
writer.close();
return;
} else {
rows = createCsvResponseForElementsGroupBy(resultSet);
GroupByResult result = (GroupByResult) resultSet[0];
if (result.getResult() instanceof UsersResult[]) {
rows = createCsvResponseForUsersGroupBy(resultSet);
} else {
rows = createCsvResponseForElementsGroupBy(resultSet);
}
}
} else {
rows = createCsvResponseForElementsRatioGroupBy(resultSet);
Expand Down

0 comments on commit ec4bacf

Please sign in to comment.