-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stat total mainlevées accordées (#2790)
* ✨ Stat Nombre Total de mainlevées accordées * 🎨 Utilisation d'un like sur les évènements de l'event store pour plus de flexibilité (si les events évoluent)
- Loading branch information
Showing
5 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../statistiques/statistiques-publiques/src/projet/nombreTotalMainlevéeAccordée.statistic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { executeQuery } from '@potentiel-libraries/pg-helpers'; | ||
|
||
import { cleanScalarStatistic } from '../_utils/cleanScalarStatistic'; | ||
|
||
const statisticType = 'nombreTotalMainlevéeAccordée'; | ||
|
||
export const cleanNombreTotalMainlevéeAccordée = cleanScalarStatistic(statisticType); | ||
|
||
export const computeNombreTotalMainlevéeAccordée = () => | ||
executeQuery( | ||
` | ||
insert | ||
into | ||
domain_public_statistic.scalar_statistic | ||
values( | ||
$1, | ||
( | ||
select | ||
count(distinct(payload->>'identifiantProjet')) | ||
from event_store.event_stream es | ||
where es.type like 'DemandeMainlevéeGarantiesFinancièresAccordée-V%' | ||
) | ||
) | ||
`, | ||
statisticType, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters