Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#47] Verwaltung von Einnahmen ermöglichen #61

Merged
merged 10 commits into from
Feb 3, 2024
Merged
3 changes: 2 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.Getter;
import timkodiert.budgetBook.domain.model.FixedExpense;
import timkodiert.budgetBook.domain.model.FixedTurnover;
import timkodiert.budgetBook.domain.repository.Repository;

@Singleton
public class FixedExpenseController {

@Getter
private final ObservableList<FixedExpense> allExpenses;
private final ObservableList<FixedTurnover> allExpenses;

private Repository<FixedExpense> repository;
private Repository<FixedTurnover> repository;

@Inject
public FixedExpenseController(Repository<FixedExpense> repository) {
public FixedExpenseController(Repository<FixedTurnover> repository) {
this.repository = repository;
this.allExpenses = FXCollections.observableArrayList();
}

public FixedExpense getExpense(int id) {
public FixedTurnover getExpense(int id) {
return this.allExpenses.stream().filter(exp -> exp.getId() == id).findFirst().get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public class AccountTurnover extends BaseEntity {
@Setter
@ManyToOne(cascade = CascadeType.MERGE)
@JoinColumn(name = "fixed_expense_id")
private FixedExpense fixedExpense;
private FixedTurnover fixedExpense;

@Setter
@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name = "unique_expense_id")
private UniqueExpense uniqueExpense;
private UniqueTurnover uniqueExpense;

public AccountTurnover(LocalDate date, String receiver, String postingText, String reference, double amount) {
this.date = date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public class Category extends BaseEntity {
private List<Category> children = new ArrayList<>();

@ManyToMany(mappedBy = "categories")
private List<FixedExpense> fixedExpenses = new ArrayList<>();
private List<FixedTurnover> fixedExpenses = new ArrayList<>();

@ManyToMany(mappedBy = "categories")
private List<UniqueExpenseInformation> uniqueExpenseInformation = new ArrayList<>();
private List<UniqueTurnoverInformation> uniqueExpenseInformation = new ArrayList<>();

@Transient
private CheckBoxTreeItem<Category> treeItem = new CheckBoxTreeItem<>();
Expand Down Expand Up @@ -80,8 +80,8 @@ public boolean contentEquals(Object other) {
List<Integer> otherExpIds = cat.getFixedExpenses().stream().map(BaseEntity::getId).toList();
equals = equals && thisExpIds.containsAll(otherExpIds) && otherExpIds.containsAll(thisExpIds);

List<Integer> thisInfoIds = this.getUniqueExpenseInformation().stream().map(UniqueExpenseInformation::getId).toList();
List<Integer> otherInfoIds = cat.getUniqueExpenseInformation().stream().map(UniqueExpenseInformation::getId).toList();
List<Integer> thisInfoIds = this.getUniqueExpenseInformation().stream().map(UniqueTurnoverInformation::getId).toList();
List<Integer> otherInfoIds = cat.getUniqueExpenseInformation().stream().map(UniqueTurnoverInformation::getId).toList();
equals = equals && thisInfoIds.containsAll(otherInfoIds) && otherInfoIds.containsAll(thisInfoIds);
return equals;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import timkodiert.budgetBook.i18n.LanguageManager;

public class CumulativeExpense implements FixedTurnover {
public class CumulativeExpense implements IFixedTurnover {

private final Map<MonthYear, Double> valueMap = new HashMap<>();

public CumulativeExpense(List<? extends FixedTurnover> turnovers, int startYear, int endYear) {
public CumulativeExpense(List<? extends IFixedTurnover> turnovers, int startYear, int endYear) {
IntStream.rangeClosed(startYear, endYear).boxed().forEach(year -> {
IntStream.rangeClosed(1, 12).forEach(month -> {
valueMap.put(MonthYear.of(month, year), 0.0);
Expand Down
135 changes: 0 additions & 135 deletions src/main/java/timkodiert/budgetBook/domain/model/FixedExpense.java

This file was deleted.

Loading
Loading