From f30f896f7bdea5933b6cdc57c4b8dd504ab1694f Mon Sep 17 00:00:00 2001 From: Filippo Ferrari Date: Sat, 27 Jul 2024 23:05:06 +0200 Subject: [PATCH] refactor --- README.md | 6 +++--- src/main/java/com/application/munera/data/Person.java | 3 +-- .../java/com/application/munera/views/login/LoginView.java | 4 +--- .../com/application/munera/views/people/PeopleView.java | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1526a1f..61f5e3d 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Munera is a companion for managing expenses efficiently and effortlessly, whethe - If possible, the calculations should take into account the different currencies 5. **Events** - - ~~Options to create events in which to put expenses (vacations, congress, etc)~~ + - ~~Options to create events in which to put expenses (vacations, congress, etc.)~~ - ~~Each event has a number of people connected to it, expenses can be added to these people~~ - A reports tells which people need to give/take money to which people in order to be even @@ -69,8 +69,8 @@ Munera is a companion for managing expenses efficiently and effortlessly, whethe ## Known Issues -- PeopleVIew dosent refresh after an edit operation anymore +- PeopleVIew doesn't refresh after an edit operation anymore - Form still needs more validation when empty, some entities can be created with all null values, even the ones that have constraints throw SQL errors, they need to be gracefully handled. - Errors need to be caught and handled - Graphs still need ~~a lot of~~ **some** improvements -- ~~ExpenseView dosent refresh after an edit operation anymore~~ \ No newline at end of file +- ~~ExpenseView doesn't refresh after an edit operation anymore~~ \ No newline at end of file diff --git a/src/main/java/com/application/munera/data/Person.java b/src/main/java/com/application/munera/data/Person.java index 14ac434..05f06d8 100644 --- a/src/main/java/com/application/munera/data/Person.java +++ b/src/main/java/com/application/munera/data/Person.java @@ -54,10 +54,9 @@ public class Person extends AbstractEntity { if (obj == this) { return true; } - if (!(obj instanceof Person)) { + if (!(obj instanceof Person other)) { return false; } - Person other = (Person) obj; return Objects.equals(firstName, other.firstName) && Objects.equals(lastName, other.lastName) && Objects.equals(email, other.email); diff --git a/src/main/java/com/application/munera/views/login/LoginView.java b/src/main/java/com/application/munera/views/login/LoginView.java index 40704da..00a5ebc 100644 --- a/src/main/java/com/application/munera/views/login/LoginView.java +++ b/src/main/java/com/application/munera/views/login/LoginView.java @@ -36,9 +36,7 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver { login.setI18n(i18n); // Add a listener for the Forgot password button - login.addForgotPasswordListener(event -> { - Notification.show("Tough shit, feature aint ready yet!", 3000, Notification.Position.BOTTOM_CENTER); - }); + login.addForgotPasswordListener(event -> Notification.show("Tough shit, feature aint ready yet!", 3000, Notification.Position.BOTTOM_CENTER)); add(new H1("Munera"), new H2("An expense tracking application"), login); } diff --git a/src/main/java/com/application/munera/views/people/PeopleView.java b/src/main/java/com/application/munera/views/people/PeopleView.java index 99f6b0e..e1bdd5b 100644 --- a/src/main/java/com/application/munera/views/people/PeopleView.java +++ b/src/main/java/com/application/munera/views/people/PeopleView.java @@ -146,7 +146,7 @@ public class PeopleView extends Div implements BeforeEnterObserver { } private String getNodeCost(Object node) { - if (node instanceof Person) return this.personService.calculateNetBalance((Person) node).toString() + " €"; + if (node instanceof Person) return this.personService.calculateNetBalance((Person) node) + " €"; else if (node instanceof Expense) return ((Expense) node).getCost().toString() + " €"; return ""; }