diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-07 14:03:59 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-07 14:03:59 -0400 |
commit | 81917b7cae6d3d22bc8e54f7b2bd416acd70475f (patch) | |
tree | e101bfb241458583d0f896975bc797ef77211c6a /ufund-ui/src/app/components/dashboard/dashboard.component.ts | |
parent | b6bc0e5e9be234c58ad5d8554f6614d22e2738f8 (diff) | |
download | JellySolutions-81917b7cae6d3d22bc8e54f7b2bd416acd70475f.tar.gz JellySolutions-81917b7cae6d3d22bc8e54f7b2bd416acd70475f.tar.bz2 JellySolutions-81917b7cae6d3d22bc8e54f7b2bd416acd70475f.zip |
Added total physical contributions to dashboard and funding basket
Diffstat (limited to '')
-rw-r--r-- | ufund-ui/src/app/components/dashboard/dashboard.component.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts index 2ab4db2..b73be44 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.ts +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts @@ -16,10 +16,11 @@ import {userType} from '../../models/User'; export class DashboardComponent implements OnInit{ protected count = new BehaviorSubject<number | undefined>(undefined) - protected totalDonations = new BehaviorSubject<number | undefined>(undefined) + protected totalDonations = new BehaviorSubject<String | undefined>(undefined) protected totalNeeds = new BehaviorSubject<number | undefined>(undefined) protected fulfilledNeeds = new BehaviorSubject<Need[] | undefined>(undefined) protected mostFulfilledNeeds = new BehaviorSubject<Need[] | undefined>(undefined) + protected physicalTotal: string[] = [] constructor( protected authService: AuthService, @@ -30,15 +31,20 @@ export class DashboardComponent implements OnInit{ ngOnInit() { this.userService.getCount().subscribe(count => this.count.next(count)) + this.physicalTotal = [] this.cupboardService.getNeeds().subscribe(needs => { let totalValue = 0 for (let need of needs) { if (need.type === GoalType.MONETARY) { totalValue += need.current - this.totalDonations.next(totalValue) + this.totalDonations.next(totalValue.toLocaleString()) + } else { + this.physicalTotal.push(need.name + ": " + need.current) } } + + this.physicalTotal.sort((a, b) => a < b ? -1 : 1); this.fulfilledNeeds.next(needs.filter(a => ((a.current / a.maxGoal)) >= 1)) needs.sort((a, b) => b.current/b.maxGoal - a.current/a.maxGoal) |