Skip to content

Commit

Permalink
Updated TransactionArchive class
Browse files Browse the repository at this point in the history
  • Loading branch information
elisab3 committed Apr 23, 2026
1 parent c567e2a commit 4a9644b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/Model/TransactionArchive.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ public List<Transaction> getTransactions(int week) {
}

public List<Purchase> getPurchase(int week) {
return transactions.stream().filter(transaction -> transaction.getWeek() == week).filter(purchase -> transactions instanceof Purchase).map(transaction -> (Purchase) transaction).collect(Collectors.toList());
return transactions.stream().filter(transaction -> transaction.getWeek() == week).filter(purchase -> purchase instanceof Purchase).map(transaction -> (Purchase) transaction).collect(Collectors.toList());
}

public List<Sale> getSale(int week) {
return transactions.stream().filter(transaction -> transaction.getWeek() == week).filter(sale -> transactions instanceof Sale).map(transaction -> (Sale) transaction).collect(Collectors.toList());
return transactions.stream().filter(transaction -> transaction.getWeek() == week).filter(sale -> sale instanceof Sale).map(transaction -> (Sale) transaction).collect(Collectors.toList());
}

public List<Transaction> getAllTransactions() {
return new ArrayList<>(transactions);
}

public int countDistinctWeeks() {
Expand Down

0 comments on commit 4a9644b

Please sign in to comment.