From 7a5c5073e9e410b3ccc3ab7902a0d6f558277c7d Mon Sep 17 00:00:00 2001 From: Angelina Zhen Date: Mon, 17 Mar 2025 22:18:47 -0400 Subject: part of funding basket ts and html --- .../funding-basket/funding-basket.component.html | 42 +++++++++++- .../funding-basket/funding-basket.component.ts | 79 +++++++++++++++++++++- 2 files changed, 118 insertions(+), 3 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.html b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html index 3fb2b5b..0a880af 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.html +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html @@ -1 +1,41 @@ -

funding-basket works!

+

Funding Basket

+ +
+ + {{ needCount }} +
+ +
+

There are no needs in the basket

+
+ + + + + + + + + + + + +
+ + {{need.name}} + +
+ +
+
+
+ +
+
+
+
+ +
\ No newline at end of file diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index 8b12306..1dcebc5 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -1,4 +1,9 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; +import {User} from '../../models/User'; +import { UsersService } from '../../services/users.service'; +import { Need } from '../../models/Need'; +import { NeedListComponent } from '../need-list/need-list.component'; +import { Router } from '@angular/router'; @Component({ selector: 'app-funding-basket', @@ -6,6 +11,76 @@ import { Component } from '@angular/core'; templateUrl: './funding-basket.component.html', styleUrl: './funding-basket.component.css' }) -export class FundingBasketComponent { +export class FundingBasketComponent implements + OnInit { + user!: User; + basket: Need[] = []; + needCount = 0; + need_quantity: {[key: number]: number} = {}; + constructor( + private router: Router, + private usersService: UsersService + ) {} + + ngOnInit(): void { + if (!this.usersService.getCurrentUser()) { + this.router.navigate(['/login'], {queryParams: {redir: this.router.url}}); + return; + } + this.usersService.getCurrentUser()?.subscribe(user => { + this.user = user; + this.getBasketNeeds(); + }); + } + + getBasketNeeds(): void { + if (this.user && this.user.cupboard) { + this.user.cupboard.forEach(need => { + if (this.isInBasket(need)){ + this.basket.push(need); + } + }); + } + } + + isInBasket(need: Need): boolean { + return this.basket.some(n => n.id == need.id); + } + + addNeed(need: Need, quantity: number=1): void { + if (this.user && !this.isInBasket(need)) { + this.basket.push(need); + this.need_quantity[need.id] = quantity; + } if (this.isInBasket(need)) { + this.need_quantity[need.id] += quantity; + } + this.needCount++; + } + + removeNeed(need: Need, quantity:number=1): void { + if (this.user && this.isInBasket(need)) { + this.need_quantity[need.id] -= quantity; + if (this.need_quantity[need.id] === 0) { + this.basket = this.basket.filter(n => need.id !== n.id); + } + this.needCount--; + } + } + + removeAllNeeds(): void { + this.basket.forEach(need => { + this.need_quantity = []; + }); + this.basket = []; + this.needCount = 0; + } + + isBasketEmpty(): boolean { + return this.needCount === 0; + } + + checkout(): void { + this.removeAllNeeds(); + } } -- cgit v1.2.3 From 1dd36e3643f646443555554d6de024653373fc8f Mon Sep 17 00:00:00 2001 From: sowgro Date: Mon, 17 Mar 2025 23:34:04 -0400 Subject: fix errors in funding basket --- .../funding-basket/funding-basket.component.ts | 132 ++++++++++----------- 1 file changed, 65 insertions(+), 67 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index 31f2982..c65e25f 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -1,86 +1,84 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {User} from '../../models/User'; -import { UsersService } from '../../services/users.service'; -import { Need } from '../../models/Need'; -import { NeedListComponent } from '../need-list/need-list.component'; -import { Router } from '@angular/router'; +import {UsersService} from '../../services/users.service'; +import {Need} from '../../models/Need'; +import {NeedListComponent} from '../need-list/need-list.component'; +import {Router} from '@angular/router'; @Component({ - selector: 'app-funding-basket', - standalone: false, - templateUrl: './funding-basket.component.html', - styleUrl: './funding-basket.component.css' + selector: 'app-funding-basket', + standalone: false, + templateUrl: './funding-basket.component.html', + styleUrl: './funding-basket.component.css' }) -export class FundingBasketComponent implements - OnInit { - user!: User; - basket: Need[] = []; - needCount = 0; - need_quantity: {[key: number]: number} = {}; +export class FundingBasketComponent implements OnInit { + user: User | null | undefined; + basket: Need[] = []; + needCount = 0; + need_quantity: { [key: number]: number } = {}; - constructor( - private router: Router, - private usersService: UsersService - ) {} - - ngOnInit(): void { - if (!this.usersService.getCurrentUser()) { - this.router.navigate(['/login'], {queryParams: {redir: this.router.url}}); - return; + constructor( + private router: Router, + private usersService: UsersService + ) { } - this.usersService.getCurrentUser()?.subscribe(user => { - this.user = user; - this.getBasketNeeds(); - }); - } - getBasketNeeds(): void { - if (this.user && this.user.cupboard) { - this.user.cupboard.forEach(need => { - if (this.isInBasket(need)){ - this.basket.push(need); + ngOnInit(): void { + if (!this.usersService.getCurrentUser()) { + this.router.navigate(['/login'], {queryParams: {redir: this.router.url}}); + return; } - }); + this.user = this.usersService.getCurrentUser() } - } - isInBasket(need: Need): boolean { - return this.basket.some(n => n.id == need.id); - } + getBasketNeeds(): void { + if (this.user && this.user.basket) { + this.user.basket.forEach(need => { + if (this.isInBasket(need)) { + this.basket.push(need); + } + }); + } + } - addNeed(need: Need, quantity: number=1): void { - if (this.user && !this.isInBasket(need)) { - this.basket.push(need); - this.need_quantity[need.id] = quantity; - } if (this.isInBasket(need)) { - this.need_quantity[need.id] += quantity; + isInBasket(need: Need): boolean { + return this.basket.some(n => n.id == need.id); } - this.needCount++; + + addNeed(need: Need, quantity: number = 1): void { + if (this.user && !this.isInBasket(need)) { + this.basket.push(need); + this.need_quantity[need.id] = quantity; + } + if (this.isInBasket(need)) { + this.need_quantity[need.id] += quantity; + } + this.needCount++; } - removeNeed(need: Need, quantity:number=1): void { - if (this.user && this.isInBasket(need)) { - this.need_quantity[need.id] -= quantity; - if (this.need_quantity[need.id] === 0) { - this.basket = this.basket.filter(n => need.id !== n.id); - } - this.needCount--; + removeNeed(need: Need, quantity: number = 1): void { + if (this.user && this.isInBasket(need)) { + this.need_quantity[need.id] -= quantity; + if (this.need_quantity[need.id] === 0) { + this.basket = this.basket.filter(n => need.id !== n.id); + } + this.needCount--; + } } - } - removeAllNeeds(): void { - this.basket.forEach(need => { - this.need_quantity = []; - }); - this.basket = []; - this.needCount = 0; - } + removeAllNeeds(): void { + this.basket.forEach(need => { + this.need_quantity = []; + }); + this.basket = []; + this.needCount = 0; + } - isBasketEmpty(): boolean { - return this.needCount === 0; - } + isBasketEmpty(): boolean { + return this.needCount === 0; + } - checkout(): void { - this.removeAllNeeds(); - } + checkout(): void { + this.removeAllNeeds(); + } } -- cgit v1.2.3 From ea1eb74494392c809396545317bbf3d4ec7696ba Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 17 Mar 2025 23:39:47 -0400 Subject: populate needs --- .../src/app/components/funding-basket/funding-basket.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index 31f2982..d3b0a7f 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -4,6 +4,7 @@ import { UsersService } from '../../services/users.service'; import { Need } from '../../models/Need'; import { NeedListComponent } from '../need-list/need-list.component'; import { Router } from '@angular/router'; +import { CupboardService } from '../../services/cupboard.service'; @Component({ selector: 'app-funding-basket', @@ -14,13 +15,14 @@ import { Router } from '@angular/router'; export class FundingBasketComponent implements OnInit { user!: User; + needs: Need[] = []; basket: Need[] = []; needCount = 0; need_quantity: {[key: number]: number} = {}; constructor( private router: Router, - private usersService: UsersService + private cupboardService: CupboardService, private usersService: UsersService ) {} ngOnInit(): void { @@ -28,6 +30,7 @@ export class FundingBasketComponent implements this.router.navigate(['/login'], {queryParams: {redir: this.router.url}}); return; } + this.cupboardService.getNeeds().subscribe(n => this.needs = n) this.usersService.getCurrentUser()?.subscribe(user => { this.user = user; this.getBasketNeeds(); -- cgit v1.2.3 From 361f73f967475089e995b62079316bd91232570e Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 17 Mar 2025 23:44:37 -0400 Subject: implemetation of needs from API call --- .../components/funding-basket/funding-basket.component.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index d3b0a7f..418158f 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -31,15 +31,16 @@ export class FundingBasketComponent implements return; } this.cupboardService.getNeeds().subscribe(n => this.needs = n) - this.usersService.getCurrentUser()?.subscribe(user => { - this.user = user; - this.getBasketNeeds(); - }); + const currentUser = this.usersService.getCurrentUser(); + if (currentUser) { + this.user = currentUser; + } + this.getBasketNeeds(); } getBasketNeeds(): void { - if (this.user && this.user.cupboard) { - this.user.cupboard.forEach(need => { + if (this.user && this.needs) { + this.needs.forEach(need => { if (this.isInBasket(need)){ this.basket.push(need); } -- cgit v1.2.3 From 2ee4d91af8262c978120b0d540a86386309b4e54 Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 17 Mar 2025 23:50:17 -0400 Subject: fixing errors in funding basket --- .../funding-basket/funding-basket.component.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index a6ee8fc..42015fe 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -1,17 +1,10 @@ import {Component, OnInit} from '@angular/core'; import {User} from '../../models/User'; -<<<<<<< HEAD import { UsersService } from '../../services/users.service'; import { Need } from '../../models/Need'; import { NeedListComponent } from '../need-list/need-list.component'; import { Router } from '@angular/router'; import { CupboardService } from '../../services/cupboard.service'; -======= -import {UsersService} from '../../services/users.service'; -import {Need} from '../../models/Need'; -import {NeedListComponent} from '../need-list/need-list.component'; -import {Router} from '@angular/router'; ->>>>>>> 1dd36e3643f646443555554d6de024653373fc8f @Component({ selector: 'app-funding-basket', @@ -45,15 +38,6 @@ export class FundingBasketComponent implements this.getBasketNeeds(); } - getBasketNeeds(): void { - if (this.user && this.needs) { - this.needs.forEach(need => { - if (this.isInBasket(need)){ - this.basket.push(need); - } - this.user = this.usersService.getCurrentUser() - } - getBasketNeeds(): void { if (this.user && this.user.basket) { this.user.basket.forEach(need => { -- cgit v1.2.3 From 02858a9af74b5f564b882adf38391dd3a1f5126c Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 18 Mar 2025 00:01:16 -0400 Subject: add need to basket --- .../app/components/need-list/need-list.component.html | 2 ++ .../app/components/need-list/need-list.component.ts | 19 +++++++++++++++++++ ufund-ui/src/app/services/users.service.ts | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 07f6735..fce6377 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -14,6 +14,7 @@ {{need.name}} + @@ -23,4 +24,5 @@ {{need.name}} + diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index b21979f..953904c 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -96,6 +96,25 @@ export class NeedListComponent { return type === ("MANAGER" as unknown as userType); } + isHelper() { + const type = this.usersService.getCurrentUser()?.type; + console.log(type); + return type === ("HELPER" as unknown as userType); + } + + add(need: Need) { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser) { + this.usersService.updateUser(currentUser.username).subscribe(() => { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser && currentUser.basket) { + currentUser.basket.push(need); + } + }); + } + + } + back() { this.searchResults = []; } diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts index c570ccf..f3166cc 100644 --- a/ufund-ui/src/app/services/users.service.ts +++ b/ufund-ui/src/app/services/users.service.ts @@ -40,7 +40,7 @@ export class UsersService { return this.http.get(`${this.url}/${id}`, this.httpOptions) } - updateUser(id: number): Observable { + updateUser(id: string): Observable { return this.http.put(`${this.url}/${id}`, this.httpOptions) } -- cgit v1.2.3 From 67ef92fbde4ab5cbe10bb9ad8556087b6d60e8ca Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 18 Mar 2025 00:24:21 -0400 Subject: logging error handling --- ufund-ui/src/app/components/need-list/need-list.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 953904c..0afa79e 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -98,7 +98,6 @@ export class NeedListComponent { isHelper() { const type = this.usersService.getCurrentUser()?.type; - console.log(type); return type === ("HELPER" as unknown as userType); } @@ -109,8 +108,13 @@ export class NeedListComponent { const currentUser = this.usersService.getCurrentUser(); if (currentUser && currentUser.basket) { currentUser.basket.push(need); + console.log("added to basket"); + } + error: (err: any) => { + console.error(err); } }); + } } -- cgit v1.2.3 From 3564917a539bc5bba7e149b8c157e0bd633be23e Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 18 Mar 2025 00:24:42 -0400 Subject: Fix problem in userService --- ufund-ui/src/app/components/need-list/need-list.component.ts | 4 ++-- ufund-ui/src/app/services/users.service.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 953904c..34e849d 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -105,14 +105,14 @@ export class NeedListComponent { add(need: Need) { const currentUser = this.usersService.getCurrentUser(); if (currentUser) { - this.usersService.updateUser(currentUser.username).subscribe(() => { + this.usersService.updateUser(currentUser.username, currentUser).subscribe(() => { const currentUser = this.usersService.getCurrentUser(); if (currentUser && currentUser.basket) { currentUser.basket.push(need); } }); } - + } back() { diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts index f3166cc..bd6fe5e 100644 --- a/ufund-ui/src/app/services/users.service.ts +++ b/ufund-ui/src/app/services/users.service.ts @@ -40,8 +40,9 @@ export class UsersService { return this.http.get(`${this.url}/${id}`, this.httpOptions) } - updateUser(id: string): Observable { - return this.http.put(`${this.url}/${id}`, this.httpOptions) + updateUser(id: string, user: User): Observable { + console.log(this.apiKey) + return this.http.put(`${this.url}/${id}`,user, this.httpOptions) } deleteUser(id: number): Observable { -- cgit v1.2.3 From a5b811ab467a2225aa316be0e62f661fad2080d2 Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 18 Mar 2025 00:41:05 -0400 Subject: hide search form on open --- ufund-ui/src/app/components/need-list/need-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index fb09632..0e808dc 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -24,7 +24,7 @@ export class NeedListComponent { ngOnInit(): void { this.refresh() - // this.close(); + this.close(); } private showElement(element: any) { -- cgit v1.2.3 From a5046e6bf22308ae516ef6d7abb5ae8709e925db Mon Sep 17 00:00:00 2001 From: Akash Keshav <112591754+domesticchores@users.noreply.github.com> Date: Tue, 18 Mar 2025 01:10:56 -0400 Subject: added log out button. -ak --- ufund-ui/src/app/app.component.html | 2 +- ufund-ui/src/app/app.component.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index 6b9338c..a490237 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -1,6 +1,6 @@

jelly solutions

-{{currentUser$ | async}} +{{currentUser$ | async}}

diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 6f4e1f5..7dc8ffb 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,6 +1,7 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, OnInit, Inject} from '@angular/core'; import {UsersService} from './services/users.service'; import {BehaviorSubject} from 'rxjs'; +import { DOCUMENT } from '@angular/common'; @Component({ selector: 'app-root', @@ -13,9 +14,14 @@ export class AppComponent implements OnInit { currentUser$: BehaviorSubject = new BehaviorSubject("Logged out."); constructor( - private userService: UsersService + private userService: UsersService, + @Inject(DOCUMENT) private document: Document ) {} + reloadPage() { + this.document.defaultView?.location.reload(); + } + ngOnInit() { this.userService.getCurrentUserSubject().subscribe(r => { this.currentUser$?.next(r -- cgit v1.2.3 From b9d7dc1cf8962978652e5814e6a5c936d4ff9b61 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 18 Mar 2025 01:13:04 -0400 Subject: push changes so far --- .../src/app/components/funding-basket/funding-basket.component.ts | 2 +- ufund-ui/src/app/components/need-list/need-list.component.ts | 4 ++-- ufund-ui/src/app/models/User.ts | 2 +- ufund-ui/src/app/services/users.service.ts | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index 42015fe..9d25212 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -49,7 +49,7 @@ export class FundingBasketComponent implements } isInBasket(need: Need): boolean { - return this.basket.some(n => n.id == need.id); + return this.basket.includes(need) } addNeed(need: Need, quantity: number = 1): void { diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 0e808dc..5bb3887 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -101,7 +101,7 @@ export class NeedListComponent { return type === ("HELPER" as unknown as userType); } - add(need: Need) { + add(need: number) { const currentUser = this.usersService.getCurrentUser(); if (currentUser) { this.usersService.updateUser(currentUser.username, currentUser).subscribe(() => { @@ -114,7 +114,7 @@ export class NeedListComponent { console.error(err); } }); - + } } diff --git a/ufund-ui/src/app/models/User.ts b/ufund-ui/src/app/models/User.ts index b640e04..f4396f6 100644 --- a/ufund-ui/src/app/models/User.ts +++ b/ufund-ui/src/app/models/User.ts @@ -7,6 +7,6 @@ export enum userType { export interface User { username: string; - basket: Need[]; + basket: number[]; type: userType } diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts index bd6fe5e..bc31870 100644 --- a/ufund-ui/src/app/services/users.service.ts +++ b/ufund-ui/src/app/services/users.service.ts @@ -41,6 +41,7 @@ export class UsersService { } updateUser(id: string, user: User): Observable { + console.log(id, user) console.log(this.apiKey) return this.http.put(`${this.url}/${id}`,user, this.httpOptions) } -- cgit v1.2.3 From fad716f3df7f984b733ea073dec4db299d4ce08e Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Tue, 18 Mar 2025 07:46:46 -0400 Subject: Commented out bugged lines --- .../src/app/components/funding-basket/funding-basket.component.ts | 6 +++--- ufund-ui/src/app/components/need-list/need-list.component.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index 9d25212..dd68c0c 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -41,9 +41,9 @@ export class FundingBasketComponent implements getBasketNeeds(): void { if (this.user && this.user.basket) { this.user.basket.forEach(need => { - if (this.isInBasket(need)) { - this.basket.push(need); - } + // if (this.isInBasket(need)) { + // this.basket.push(need); + // } }); } } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index fce6377..4a67dfa 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -14,7 +14,7 @@ {{need.name}} - + @@ -24,5 +24,5 @@ {{need.name}} - + -- cgit v1.2.3 From 03077b567f41aa639efa065742481e91830ade57 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 18 Mar 2025 07:48:25 -0400 Subject: fix password bug --- ufund-api/src/main/java/com/ufund/api/ufundapi/model/User.java | 4 ++++ .../src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/User.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/User.java index f08f9f0..1c1d474 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/User.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/User.java @@ -67,4 +67,8 @@ public class User { return type; } + public void copyPassword(User other) { + this.passwordHash = other.passwordHash; + } + } diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java index f17f8f2..f809aac 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java @@ -81,7 +81,8 @@ public class UserFileDAO implements UserDAO { public User updateUser(User user) throws IOException { synchronized (users) { if (users.containsKey(user.getUsername())) { - users.put(user.getUsername(), user); + var old = users.put(user.getUsername(), user); + user.copyPassword(old); save(); return user; } else { -- cgit v1.2.3