Skip to content

Commit

Permalink
Merge pull request #79 from cathrkri/hotfix/everything-after-#77
Browse files Browse the repository at this point in the history
Hotfix/everything after #77
  • Loading branch information
apbaluna authored Apr 22, 2026
2 parents ef3b1bf + fdc5d16 commit fa18126
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 230 deletions.
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

0 comments on commit fa18126

Please sign in to comment.