Skip to content

Commit

Permalink
Consider loan also as part of it
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Nov 1, 2024
1 parent e7db038 commit f5034fb
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions lib/ui/presentation/dashboard_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,17 @@ class DashboardPresenter extends Presenter<DashboardViewState> {
Map<DateTime, double> investmentByMonth = {};

for (var investment in investments) {
if (investment.getTotalInvestedAmount() > 0) {
investment
.getPayments(till: DateTime.now())
.map((e) => MapEntry(e.createdOn, e.amount))
.forEach((entry) {
if(entry.key.isAfter(DateTime.now().subtract(const Duration(days: 365)))) {
DateTime month = DateTime(entry.key.year, entry.key.month);
investmentByMonth.update(month, (value) => value + entry.value,
ifAbsent: () => entry.value);
}
});
}
investment
.getPayments(till: DateTime.now())
.map((e) => MapEntry(e.createdOn, e.amount))
.forEach((entry) {
if (entry.key
.isAfter(DateTime.now().subtract(const Duration(days: 365)))) {
DateTime month = DateTime(entry.key.year, entry.key.month);
investmentByMonth.update(month, (value) => value + entry.value,
ifAbsent: () => entry.value);
}
});
}

return investmentByMonth;
Expand Down

0 comments on commit f5034fb

Please sign in to comment.