Mias à jour des KPI

This commit is contained in:
ocroguennec committed 2026-08-21 10:38:13 +02:00
1 parent 6c96e023a9
commit b48731ec50
2 files changed
+72 -12

No files matched your search

+7 -1
View File
@@ -152,6 +152,12 @@ router.get('/', (req, res) => {
cashByPlatformEnriched.reduce((s, p) => s + p.solde_portefeuille, 0) * 100
) / 100;
// Total des corrections de solde, toutes plateformes confondues (cumul complet
// quand asOf est absent) — utilisé par le KPI "Gain net depuis le début" du Dashboard.
const corrections_total = Math.round(
correctionsPerPlat.reduce((s, r) => s + r.total_correction, 0) * 100
) / 100;
/* ── Portfolio ───────────────────────────────────────────────── */
const portfolio = db.prepare(`
SELECT
@@ -242,7 +248,7 @@ router.get('/', (req, res) => {
ORDER BY i.date_souscription DESC
`).all(...invParams);
res.json({ cash, cashByPlatform: cashByPlatformEnriched, solde_portefeuille_total, portfolio, interets, interetsParAnnee, upcoming, enDefaut });
res.json({ cash, cashByPlatform: cashByPlatformEnriched, solde_portefeuille_total, corrections_total, portfolio, interets, interetsParAnnee, upcoming, enDefaut });
});