From 52446a59f93c2650e81360aae3f522edeb0def44 Mon Sep 17 00:00:00 2001 From: Paul Huerkamp <35733278+PAException@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:25:14 +0100 Subject: [PATCH] Hotfix substitute appended text --- .../api/service/scheduled/SubstituteUpdateService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/paexception/engelsburg/api/service/scheduled/SubstituteUpdateService.java b/src/main/java/io/github/paexception/engelsburg/api/service/scheduled/SubstituteUpdateService.java index 6296bd5..43119b1 100644 --- a/src/main/java/io/github/paexception/engelsburg/api/service/scheduled/SubstituteUpdateService.java +++ b/src/main/java/io/github/paexception/engelsburg/api/service/scheduled/SubstituteUpdateService.java @@ -185,8 +185,8 @@ public void updateSubstitutes() { //If the row does not contain a className then this row is used to extend the text from // the previous substitute, so it needs to be added to the latest substitute - String className = row.child(0).text(); - if (!substitutes.isEmpty() && !className.matches("(.*)[0-9](.*)")) { + String lesson = row.child(1).text(); + if (!substitutes.isEmpty() && !lesson.matches("(.*)[0-9](.*)")) { this.appendTextOnLastSubstitute(row, substitutes); String appendedText = substitutes.get(substitutes.size() - 1).getText(); @@ -274,7 +274,7 @@ private List createSubstituteDTOs(Element row, Date currentDate) List dtos = new ArrayList<>(); SubstituteDTO dto = new SubstituteDTO(); dto.setDate(currentDate); - dto.setClassName(row.child(0).text()); + if (row.child(0).text().matches("(.*)[0-9](.*)")) dto.setClassName(row.child(0).text()); String lessons = row.child(1).text().replace(" ", ""); if (lessons.contains("-")) { //5 - 6, //3 - 6 int low = Integer.parseInt(lessons.substring(0, lessons.indexOf("-"))),