diff --git a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/AvailableOrganizationController.java b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/AvailableOrganizationController.java index 5a9386e..b7d1444 100644 --- a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/AvailableOrganizationController.java +++ b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/AvailableOrganizationController.java @@ -53,6 +53,8 @@ public void initialize() { CharityRegistry charities = db.getCharitiesFromDB(); allCharities = charities.getAllCharities(); + + cardsContainer.getChildren().clear(); searchField @@ -77,8 +79,20 @@ private List filterCharities(String query) { } for (Charity charity : allCharities) { - String name = charity.getName().toLowerCase(); - String description = charity.getDescription().toLowerCase(); + String name = charity.getName(); + String description = charity.getDescription(); + + if (name == null || name.isBlank()){ + name = "This one has no name"; + } else { + name = name.toLowerCase(); + } + if (description == null || description.isBlank()){ + description = "This one has no description"; + } else { + description = description.toLowerCase(); + } + if (name.contains(query) || description.contains(query)) { matches.add(charity); diff --git a/helpmehelpapplication/src/main/resources/fxml/available_organizations.fxml b/helpmehelpapplication/src/main/resources/fxml/available_organizations.fxml index 51e0525..bce73a2 100644 --- a/helpmehelpapplication/src/main/resources/fxml/available_organizations.fxml +++ b/helpmehelpapplication/src/main/resources/fxml/available_organizations.fxml @@ -1,31 +1,19 @@ - - - - - + - - - - - + @@ -34,43 +22,33 @@
- + + - + - - - @@ -83,4 +61,4 @@ - \ No newline at end of file + diff --git a/helpmehelpapplication/src/main/resources/fxml/profile_org_edit.fxml b/helpmehelpapplication/src/main/resources/fxml/profile_org_edit.fxml index a17a1cf..215fa2b 100644 --- a/helpmehelpapplication/src/main/resources/fxml/profile_org_edit.fxml +++ b/helpmehelpapplication/src/main/resources/fxml/profile_org_edit.fxml @@ -152,7 +152,6 @@ -