Skip to content

Commit

Permalink
do not show decimal place for perentage
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Mar 5, 2020
1 parent 7783c9c commit 722344a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('extractPropertiesFromBucket', () => {
expect(properties).toEqual({
doc_count: 3,
'terms_of_machine.os.keyword': 'win xp',
'terms_of_machine.os.keyword__percentage': 33.33,
'terms_of_machine.os.keyword__percentage': 33,
});
});
});
5 changes: 3 additions & 2 deletions x-pack/legacy/plugins/maps/public/layers/util/es_agg_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export function extractPropertiesFromBucket(bucket: any, ignoreKeys: string[] =
const topBucketCount = bucket[key].buckets[0].doc_count;
const totalCount = bucket.doc_count;
if (totalCount && topBucketCount) {
properties[`${key}${TOP_TERM_PERCENTAGE_SUFFIX}`] =
_.round(topBucketCount / totalCount, 4) * 100;
properties[`${key}${TOP_TERM_PERCENTAGE_SUFFIX}`] = Math.round(
(topBucketCount / totalCount) * 100
);
}
} else {
properties[key] = bucket[key];
Expand Down

0 comments on commit 722344a

Please sign in to comment.