Skip to content

Commit

Permalink
Fix isPartOf links, always prefer given label (RPB-226)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Dec 19, 2024
1 parent f09b18e commit e6e196e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/views/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ public String process(JsonNode doc, String property, String param,
private String label(JsonNode doc, String value, List<String> properties) {
List<String> results = new ArrayList<>();
List<String> resultValues = labelsFor(doc, value, properties);
JsonNode labelNode = doc.get(properties.get(0)).iterator().next().get("label");
for (int i = 0; i < resultValues.size(); i++) {
String currentValue = resultValues.get(i);
String[] refAndLabel =
refAndLabel(properties.get(i), currentValue, Optional.empty());
String label = labelNode != null ? labelNode.textValue() : refAndLabel[1];
String result =
properties.get(i).equals("numbering") || value.equals("--")
? currentValue
: String.format(
"<a title=\"Titeldetails anzeigen\" href=\"%s\">%s</a>",
refAndLabel[0], refAndLabel[1]);
refAndLabel[0], label);
results.add(result.replace("Band", "").trim());
}
return results.stream().collect(Collectors.joining(", Band "));
Expand All @@ -129,8 +131,8 @@ private List<String> labelsFor(JsonNode doc, String value,
JsonNode node = doc.get(keys.get(0)).iterator().next();
JsonNode id = node.get("id");
JsonNode label = node.get("label");
result.add(label != null ? label.textValue()
: id != null ? id.textValue() : "--");
result.add(id != null ? id.textValue()
: label != null ? label.textValue() : "--");
JsonNode val = doc.get(keys.get(1));
if (val != null)
result.add(val.textValue());
Expand Down

0 comments on commit e6e196e

Please sign in to comment.