@opengis/bi 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -82,10 +82,10 @@ export default async function cluster(req) {
|
|
|
82
82
|
? await getFilterSQL({ pg, table, filter, search })
|
|
83
83
|
: {};
|
|
84
84
|
|
|
85
|
-
const q = `select
|
|
85
|
+
const q = `select b.*, ${clusterTable?.operator || 'sum'}("${metrics[0]}")::float as metric
|
|
86
86
|
from ${optimizedSQL ? `(${optimizedSQL})` : table} q
|
|
87
|
-
left join lateral (select "${pg.pk?.[clusterTable?.name]}" as id from ${clusterTable?.name} where ${clusterTable?.
|
|
88
|
-
where ${where} group by
|
|
87
|
+
left join lateral (select "${pg.pk?.[clusterTable?.name]}" as id, ${clusterTable?.column || cluster} as name, ${clusterTable?.title} as title from ${clusterTable?.name} where ${clusterTable?.codifierColumn || 'codifier'}=q."${clusterTable?.column || cluster}" limit 1)b on 1=1
|
|
88
|
+
where ${where} group by b.id, b.name, b.title order by ${clusterTable?.operator || 'sum'}("${metrics[0]}")::float desc`;
|
|
89
89
|
|
|
90
90
|
if (query.sql === '1') return q;
|
|
91
91
|
|