Skip to content

Hotfix/everything after #77 #79

Merged
merged 5 commits into from
Apr 22, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public void start(Stage stage) throws Exception {
stage.setFullScreen(true);

stage.show();
// Re-enter fullscreen when restored from taskbar
stage.iconifiedProperty().addListener((obs, wasIconified, isNowIconified) -> {
if (!isNowIconified) {
stage.setFullScreen(true);
}
});
}

@Override
Expand Down Expand Up @@ -78,9 +84,8 @@ public void init() {
*/

// Comment out the two below to use already generated database.
CharityRegistry charityRegistry = scraper.getAPIAndURLCharityData();

db.addAPIDataToTable(charityRegistry.getAllCharities());
//CharityRegistry charityRegistry = scraper.getAPIAndURLCharityData();
//db.addAPIDataToTable(charityRegistry.getAllCharities());
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ protected void authTokenisSet(){
public void setCharity(Charity charity) {
this.charity = charity;


CharityDescription.setText(charity.getDescription());
CharityName.setText(charity.getName());

Expand All @@ -97,25 +98,27 @@ public void setCharity(Charity charity) {

// Sets key values to a List<Double>
String input = charity.getKeyValues();

String[] parts = input.split(":");
List<Double> numbers = new ArrayList<>();

for (String part : parts) {
part = part.replace(",", ".");
numbers.add(Double.parseDouble(part));
if (input != null) {

String[] parts = input.split(":");
List<Double> numbers = new ArrayList<>();

for (String part : parts) {
part = part.replace(",", ".");
numbers.add(Double.parseDouble(part));
}

// Sets the value of each arc and label
setArc(keyValueInnsamlingArc, numbers.getFirst());
keyValueInnsamlingLabel.setText(String.format("%.1f%%", numbers.getFirst()));
setArc(keyValueAdminArc, numbers.get(1));
keyValueAdminLabel.setText(String.format("%.1f%%", numbers.get(1)));
setArc(keyValueFormaalArc, numbers.getLast());
keyValueFormaalLabel.setText(String.format("%.1f%%", numbers.getLast()));
}

// Sets the value of each arc and label
setArc(keyValueInnsamlingArc, numbers.getFirst());
keyValueInnsamlingLabel.setText(String.format("%.1f%%", numbers.getFirst()));
setArc(keyValueAdminArc, numbers.get(1));
keyValueAdminLabel.setText(String.format("%.1f%%", numbers.get(1)));
setArc(keyValueFormaalArc, numbers.getLast());
keyValueFormaalLabel.setText(String.format("%.1f%%", numbers.getLast()));

// Sets the categories
setCategories(charity.getCategory());
// Sets the categories
setCategories(charity.getCategory());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private void loadPage(){

for (String category : categories) {
CheckBox cb = new CheckBox(category);
cb.setStyle("-fx-font-size: 12; -fx-padding: 10 0 0 20; -fx-text-fill: black" );

cb.setOnAction(
e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public static void LoadScene(String sceneName, Stage stage, Charity charity, Str
stage.setScene(scene);
stage.setFullScreen(true);
stage.show();
stage.iconifiedProperty().addListener((obs, wasIconified, isNowIconified) -> {
if (!isNowIconified) {
stage.setFullScreen(true);
}
});
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
public class profileOrgEditController extends BaseController {
@FXML
private NavbarController navbarController;

@FXML private Label charityNameLabel;
@FXML private Label charityNameLabel2;
@FXML private TextArea descriptionField;

@Override
Expand All @@ -50,6 +52,7 @@ protected void authTokenisSet() {
private void populateFields(){
Charity usersCharity = authToken.isCharityUser();
charityNameLabel.setText(usersCharity.getName());
charityNameLabel2.setText(usersCharity.getName());
descriptionField.setText(usersCharity.getDescription());
}

Expand Down Expand Up @@ -99,7 +102,7 @@ private void switchToFeedbackPage(ActionEvent event){

@FXML
private void switchToSettingsPage(ActionEvent event){
LoaderScene.LoadScene("profile_user_Settings", event, null, null, authToken);
LoaderScene.LoadScene("profile_org_Settings", event, null, null, authToken);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void switchToEditPage(ActionEvent event) {

@FXML
private void switchToSettingsPage(ActionEvent event) {
LoaderScene.LoadScene("profile_user_Settings", event, null, null, authToken);
LoaderScene.LoadScene("profile_org_Settings", event, null, null, authToken);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void switchToFeedbackPage(ActionEvent event){

@FXML
private void switchToSettingsPage(ActionEvent event){
LoaderScene.LoadScene("profile_user_Settings", event, null, null, authToken);
LoaderScene.LoadScene("profile_org_Settings", event, null, null, authToken);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public CharityRegistry getCharitiesFromDB() {
LEFT JOIN User u ON f.user_id = u.UUID_user
LEFT JOIN Charity_Categories cc ON cc.Charities_UUID_charities = c.UUID_charities
LEFT JOIN Categories cat ON cat.category_id = cc.Categories_category_id
INNER JOIN CharityVanity cv ON cv.UUID_charity = c.UUID_charities;
INNER JOIN CharityVanity cv ON cv.UUID_charity = c.UUID_charities
ORDER BY c.UUID_charities;
""";
Statement stmt = conn.createStatement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class User {
private String username;
private String email;
private String passwordHash;
private final Role role;
private Role role;
private Settings settings;
private Inbox inbox;

Expand Down Expand Up @@ -200,4 +200,12 @@ public void setInbox(Inbox inbox) {
}
this.inbox = inbox;
}

public void setRole(Role role) {
if (role == null) {
throw new IllegalArgumentException("Inbox cannot be null");
}
this.role = role;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public boolean login(String email, String password){
if (user != null){
currentUser = user;
isCharityUser = userDataReader.getUserCharityUser(currentUser.getId().toString());
if (isCharityUser != null){
currentUser.setRole(Role.CHARITY_USER);
}
System.out.println("User gotten");
return true;
}
Expand Down
Loading
Loading