Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Nov 2, 2024
1 parent c872ba3 commit 4954121
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/ui/presentation/dashboard_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ class DashboardPresenter extends Presenter<DashboardViewState> {
Map<DateTime, double> 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);
Expand Down Expand Up @@ -139,17 +137,19 @@ class DashboardPresenter extends Presenter<DashboardViewState> {
Map<DateTime, double> 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;
Expand Down

0 comments on commit 4954121

Please sign in to comment.