From c872ba348992247849a02ccfdf6a2ef048fa860b Mon Sep 17 00:00:00 2001 From: Prasanna Anbazhagan Date: Fri, 1 Nov 2024 16:06:41 +0530 Subject: [PATCH] Ignore the loan part --- lib/ui/presentation/dashboard_presenter.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ui/presentation/dashboard_presenter.dart b/lib/ui/presentation/dashboard_presenter.dart index 4c8d408..be14dcc 100644 --- a/lib/ui/presentation/dashboard_presenter.dart +++ b/lib/ui/presentation/dashboard_presenter.dart @@ -74,13 +74,15 @@ class DashboardPresenter extends Presenter { Map dateInvestmentMap = {}; for (var investment in investments) { - 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); - }); + 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); + }); + } } dateInvestmentMap.update(DateTime.now(), (value) => value, ifAbsent: () => 0);