Capacite : repli sur les sessions du branchement sans compteur historise ; point VW du 15/09

This commit is contained in:
Tallagrand Thierry
2026-10-04 01:02:49 +02:00
parent d40e8f5cdc
commit 7d7f116742
3 changed files with 28 additions and 4 deletions

View File

@@ -85,6 +85,14 @@ if (process.argv.includes('--vues')) {
eq('pas plein, pas de releve -> pas de capacite', cap.capacite_kwh, null);
await ins('TESTX', '2020-02-01T14:20Z', 777, 80, 15, 200, true);
proche('releve dans l heure : 4,5 / (80-50) %', (await capa()).capacite_kwh, 15.0);
// Saisie ancienne sans compteur historise : somme des sessions du branchement.
await ev('2020-03-01T20:00Z', 'on'); await ev('2020-03-02T04:00Z', 'off');
await c.query(`INSERT INTO session_charge (debut, fin, terminee, vehicule, vehicule_sur, energie_kwh, energie_station_kwh)
VALUES ('2020-03-01T23:25Z','2020-03-02T01:41Z',true,'TESTV',true,7.6,7.7)`);
await c.query(`INSERT INTO niveau_saisi (saisi_a, niveau_pct, ref_kwh, source) VALUES ('2020-03-01T20:00:01Z', 5, NULL, 'test')`);
await c.query(`INSERT INTO decision (ts, etat) VALUES ('2020-03-02T01:42Z','night_recovery_done_idle')`);
const v = (await c.query("SELECT * FROM capacite_estimee WHERE branche >= '2020-03-01' AND branche < '2020-03-02'")).rows[0];
proche('sans compteur : sessions du branchement 7,7 / 0,95', v.capacite_kwh, 7.7 / 0.95);
} finally { await c.query('ROLLBACK'); await c.end(); }
}
console.log(`${ok}/${ok + ko}`);