Skip to content

Commit

Permalink
#894 fix inclusion of conservation list values in facet download
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Collins committed Apr 11, 2024
1 parent fd8829a commit 47ed309
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repositories {
}

group = 'au.org.ala'
version = '3.4.0'
version = '3.4.1'


boolean inplace = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private Map<String, Set<String>> getItemsMap(Map speciesLists, boolean conservat
String status = "";
if (item.kvpValues != null) {
for (KvpDTO m : item.kvpValues) {
if (m.key != null) {
if (m.key != null && "status".equalsIgnoreCase(m.key)) {
status = ": " + m.value;
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/au/org/ala/biocache/web/OccurrenceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,14 @@ private void writeExpandedListColumns(File tmp, HttpServletResponse response) th
if (StringUtils.isNotEmpty(row[invasiveColumn])) {
String [] values = row[invasiveColumn].split("\\|");
for (String v : values) {
invasiveFields.add(v);
invasiveFields.add(v.trim());
}
}
if (StringUtils.isNotEmpty(row[conservationColumn])) {
// remove trailing value to find list name
String [] values = row[conservationColumn].split("\\|");
String[] values = row[conservationColumn].split("\\|");
for (String v : values) {
conservationFields.add(v.replaceAll(": [^:]*$", ""));
conservationFields.add(v.replaceAll(": [^:]*$", "").trim());
}
}
}
Expand All @@ -1052,13 +1052,16 @@ private void writeExpandedListColumns(File tmp, HttpServletResponse response) th
for (int i = 1; i < all.size(); i++) {
String[] row = all.get(i);
System.arraycopy(row, 0, newRow, 0, row.length - 2);
for (int j = row.length - 2; j < newRow.length; j++) {
newRow[j] = "";
}

if (StringUtils.isNotEmpty(row[invasiveColumn])) {
String[] values = row[invasiveColumn].split("\\|");
for (String v : values) {
// find column
for (int j = header.length - 2; j < newHeader.length; j++) {
if (newHeader[j].equals(v)) {
if (newHeader[j].equals(v.trim())) {
newRow[j] = "Y";
}
}
Expand All @@ -1069,11 +1072,11 @@ private void writeExpandedListColumns(File tmp, HttpServletResponse response) th
String[] values = row[conservationColumn].split("\\|");
for (String v : values) {
// column name
String name = v.replaceAll(": [^:]*$", "");
String name = v.replaceAll(": [^:]*$", "").trim();
// find column
for (int j = header.length - 2; j < newHeader.length; j++) {
if (newHeader[j].equals(name)) {
newRow[j] = v.replace(name + ": ", "");
newRow[j] = v.replace(name + ": ", "").trim();
}
}
}
Expand Down

0 comments on commit 47ed309

Please sign in to comment.