diff --git a/lib/ui/presentation/dashboard_presenter.dart b/lib/ui/presentation/dashboard_presenter.dart index be14dcc..fa27125 100644 --- a/lib/ui/presentation/dashboard_presenter.dart +++ b/lib/ui/presentation/dashboard_presenter.dart @@ -74,15 +74,13 @@ class DashboardPresenter extends Presenter { Map dateInvestmentMap = {}; for (var investment in investments) { - if (investment.getValue() > 0) { - investment - .getPayments(till: DateTime.now()) - .map((e) => MapEntry(e.createdOn, e.amount)) - .forEach((entry) { - dateInvestmentMap.update(entry.key, (value) => value + entry.value, - ifAbsent: () => entry.value); - }); - } + investment + .getPayments(till: DateTime.now()) + .map((e) => MapEntry(e.createdOn, e.amount)) + .forEach((entry) { + dateInvestmentMap.update(entry.key, (value) => value + entry.value, + ifAbsent: () => entry.value); + }); } dateInvestmentMap.update(DateTime.now(), (value) => value, ifAbsent: () => 0); @@ -139,17 +137,19 @@ class DashboardPresenter extends Presenter { Map investmentByMonth = {}; for (var investment in investments) { - 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); - } - }); + if (investment.getValue() > 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); + } + }); + } } return investmentByMonth;