mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add aggregates when adding group by
This commit is contained in:
parent
483e7c0163
commit
6e7161f238
@ -96,6 +96,14 @@ export default class PostgresQuery {
|
|||||||
partModel.part.params = ['1m', 'none'];
|
partModel.part.params = ['1m', 'none'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add aggregates when adding group by
|
||||||
|
for (let i = 0; i < this.target.select.length; i++) {
|
||||||
|
var selectParts = this.target.select[i];
|
||||||
|
if (!selectParts.some(part => part.type === 'aggregate')) {
|
||||||
|
selectParts.splice(1, 0, { type: 'aggregate', params: ['avg'] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateProjection();
|
this.updateProjection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user