Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
TouchPoint: Improve reliability of copy parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jun 29, 2023
1 parent 575e9fe commit 67989de
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,8 @@ protected DetailedItem parse_result(String html) throws IOException {
// newer versions (e.g. Chemnitz) use divs instead of tables
boolean table = copiesDoc.select(".data tr th").size() > 0;

for (Element th : copiesDoc.select(table ? ".data tr th" : ".data div.d-none > div")) {
if (th.text().contains("Zweigstelle")) {
for (Element th : copiesDoc.select(table ? ".data tr th" : ".data div.d-none > div, .data > div:first-child > div.row:first-child > div")) {
if (th.text().contains("Zweigstelle") || th.text().contains("Campus")) {
table_keys.add("branch");
} else if (th.text().contains("Status") || th.text().contains("Leihstatus")) {
table_keys.add("status");
Expand All @@ -761,7 +761,7 @@ protected DetailedItem parse_result(String html) throws IOException {
}
}
for (Element tr : copiesDoc
.select(table ? ".data tr:has(td)" : ".data > div > div:not(.d-none)")) {
.select(table ? ".data tr:has(td)" : ".data > div > div:not(.d-none):not(:first-child)")) {
Copy copy = new Copy();
int i = 0;
for (Element td : tr.select(table ? "td" : "> div")) {
Expand All @@ -770,7 +770,9 @@ protected DetailedItem parse_result(String html) throws IOException {
}
i++;
}
result.addCopy(copy);
if (copy.notEmpty()) {
result.addCopy(copy);
}
}
}

Expand Down

0 comments on commit 67989de

Please sign in to comment.