fix(back-end) calculator improvements
All checks were successful
Build, Test and Deploy / test-backend (push) Successful in 41s
Build, Test and Deploy / build-and-push (push) Successful in 40s
Build, Test and Deploy / deploy (push) Successful in 8s

This commit is contained in:
2026-02-25 15:05:23 +01:00
parent 54d12f4da0
commit fecb394272
14 changed files with 290 additions and 106 deletions

View File

@@ -208,9 +208,31 @@ export class CalculatorPageComponent implements OnInit {
// 2. Update backend session if ID exists
if (event.id) {
const currentSessionId = this.result()?.sessionId;
if (!currentSessionId) return;
this.loading.set(true);
this.estimator.updateLineItem(event.id, { quantity: event.quantity }).subscribe({
next: (res) => console.log('Line item updated', res),
error: (err) => console.error('Failed to update line item', err)
next: () => {
// 3. Fetch the updated session totals from the backend
this.estimator.getQuoteSession(currentSessionId).subscribe({
next: (sessionData) => {
const newResult = this.estimator.mapSessionToQuoteResult(sessionData);
// Preserve notes
newResult.notes = this.result()?.notes;
this.result.set(newResult);
this.loading.set(false);
},
error: (err) => {
console.error('Failed to refresh session totals', err);
this.loading.set(false);
}
});
},
error: (err) => {
console.error('Failed to update line item', err);
this.loading.set(false);
}
});
}
}