mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
limit the digits after decimal point (#14422)
This commit is contained in:
@@ -288,14 +288,14 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onCellSelectionChanged(data: string[]): void {
|
private onCellSelectionChanged(data: string[]): void {
|
||||||
const numericValues = data?.filter(value => !isNaN(parseFloat(value))).map(value => parseFloat(value));
|
const numericValues = data?.filter(value => !Number.isNaN(Number(value))).map(value => Number(value));
|
||||||
if (numericValues?.length < 2 || !(this.editorService.activeEditor instanceof QueryEditorInput)) {
|
if (numericValues?.length < 2 || !(this.editorService.activeEditor instanceof QueryEditorInput)) {
|
||||||
this.hide();
|
this.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sum = numericValues.reduce((previous, current, idx, array) => previous + current);
|
const sum = numericValues.reduce((previous, current, idx, array) => previous + current);
|
||||||
const summaryText = localize('status.query.summaryText', "Average: {0} Count: {1} Sum: {2}", sum / numericValues.length, data.length, sum);
|
const summaryText = localize('status.query.summaryText', "Average: {0} Count: {1} Sum: {2}", Number((sum / numericValues.length).toFixed(3)), data.length, sum);
|
||||||
this.statusItem.update({
|
this.statusItem.update({
|
||||||
text: summaryText,
|
text: summaryText,
|
||||||
ariaLabel: summaryText
|
ariaLabel: summaryText
|
||||||
|
|||||||
Reference in New Issue
Block a user