fix(qlik): batch SelectValues to avoid Engine abort + drop couv stock metric

Large supplier (4816 codes) triggered Qlik Engine "Request aborted"
(code 15): a single SelectValues over all codes forced the hypercube to
calculate too many rows at once. Now select in 1200-code batches and
accumulate, keeping each calc small. 1417 codes worked before, 4816 did
not - chunking scales to any supplier.

Also remove the "Couverture de stock" network column end-to-end (grid,
types, Qlik clients, cache, schema, db-init), shifting the marge measure
index from 6 to 5 and the hypercube width from 7 to 6.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Opus 4.8 committed 2026-06-21 10:55:03 +02:00
1 parent 8cc95cb387
commit de8a435c14
8 files changed
+39 -60

No files matched your search

-4
View File
@@ -16,7 +16,6 @@ export interface NetworkMetricCached {
qteReseau: number;
nbMagasinsReseau: number;
caParMagasinReseau: number;
couvertureStockReseau: number;
margePctReseau: number;
fetchedAt: string | null;
}
@@ -40,7 +39,6 @@ export async function getNetworkMetricsByCodeCentrale(
qteReseau: Number(r.qteReseau ?? 0) || 0,
nbMagasinsReseau: Number(r.nbMagasinsReseau ?? 0) || 0,
caParMagasinReseau: Number(r.caParMagasinReseau ?? 0) || 0,
couvertureStockReseau: Number(r.couvertureStockReseau ?? 0) || 0,
margePctReseau: Number(r.margePctReseau ?? 0) || 0,
fetchedAt: r.fetchedAt ? new Date(r.fetchedAt).toISOString() : null,
});
@@ -58,7 +56,6 @@ export async function upsertNetworkMetrics(metrics: NetworkMetric[]): Promise<nu
qteReseau: String(m.qteReseau),
nbMagasinsReseau: m.nbMagasinsReseau,
caParMagasinReseau: String(m.caParMagasinReseau),
couvertureStockReseau: String(m.couvertureStockReseau),
margePctReseau: String(m.margePctReseau),
periode: m.periode ?? null,
fetchedAt: now,
@@ -79,7 +76,6 @@ export async function upsertNetworkMetrics(metrics: NetworkMetric[]): Promise<nu
qteReseau: sql`excluded.qte_reseau`,
nbMagasinsReseau: sql`excluded.nb_magasins_reseau`,
caParMagasinReseau: sql`excluded.ca_par_magasin_reseau`,
couvertureStockReseau: sql`excluded.couverture_stock_reseau`,
margePctReseau: sql`excluded.marge_pct_reseau`,
periode: sql`excluded.periode`,
fetchedAt: sql`excluded.fetched_at`,