mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: implement pg-ff-client to replace per-article HTTP calls with bulk PostgreSQL queries
This commit is contained in:
1 parent
ff81bc1fc4
commit
d25ffdb3e7
1 file changed
+3
-3
@@ -759,9 +759,9 @@ export async function pgGetHitParade(dateDebut: string, dateFin: string): Promis
|
||||
stock_agg AS (
|
||||
SELECT
|
||||
cs.artnoid,
|
||||
SUM(CASE WHEN cs.site = '292' THEN cs.stockdispo ELSE 0 END)::float AS stock292,
|
||||
SUM(CASE WHEN cs.site = '579' THEN cs.stockdispo ELSE 0 END)::float AS stock579,
|
||||
SUM(cs.stockdispo)::float AS stockTotal
|
||||
SUM(CASE WHEN cs.site = '292' THEN cs.qte ELSE 0 END)::float AS stock292,
|
||||
SUM(CASE WHEN cs.site = '579' THEN cs.qte ELSE 0 END)::float AS stock579,
|
||||
SUM(cs.qte)::float AS stockTotal
|
||||
FROM cube_stock cs
|
||||
WHERE cs.artnoid IN (SELECT DISTINCT art_no_id FROM ventes)
|
||||
GROUP BY cs.artnoid
|
||||
|
||||
Reference in new issue
Block a user