diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-11-28 08:59:54 +0100 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-11-28 12:19:59 +0100 |
commit | 5880d0c5b446408b2bc50bdb587643eeff0ae99c (patch) | |
tree | 0b7818deb7ba2089f9b213a4e07a27686b7d2ee3 /server/sonar-web/src/main | |
parent | 98169441f6f81ccc39957e1f820c7104e3d2c000 (diff) | |
download | sonarqube-5880d0c5b446408b2bc50bdb587643eeff0ae99c.tar.gz sonarqube-5880d0c5b446408b2bc50bdb587643eeff0ae99c.zip |
Use correct metric suffix
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts | 14 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/measures.ts | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts index e0795b485f2..e57d404eeab 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts @@ -34,9 +34,9 @@ beforeEach(() => { 'metric.level.ERROR': 'Error', 'metric.level.WARN': 'Warning', 'metric.level.OK': 'Ok', + 'short_number_suffix.g': 'G', 'short_number_suffix.k': 'k', - 'short_number_suffix.m': 'm', - 'short_number_suffix.b': 'b' + 'short_number_suffix.m': 'M' }); }); @@ -60,7 +60,7 @@ describe('#formatMeasure()', () => { expect(formatMeasure(1529, 'SHORT_INT')).toBe('1.5k'); expect(formatMeasure(10000, 'SHORT_INT')).toBe('10k'); expect(formatMeasure(10678, 'SHORT_INT')).toBe('11k'); - expect(formatMeasure(1234567890, 'SHORT_INT')).toBe('1b'); + expect(formatMeasure(1234567890, 'SHORT_INT')).toBe('1G'); }); it('should format FLOAT', () => { @@ -130,8 +130,8 @@ describe('#formatMeasure()', () => { expect(formatMeasure(-1 * ONE_MINUTE, 'SHORT_WORK_DUR')).toBe('-1min'); expect(formatMeasure(1529 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1.5kd'); - expect(formatMeasure(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1md'); - expect(formatMeasure(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('1md'); + expect(formatMeasure(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1Md'); + expect(formatMeasure(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('1Md'); }); it('should format RATING', () => { @@ -247,8 +247,8 @@ describe('#formatMeasureVariation()', () => { expect(formatMeasureVariation(-1 * ONE_MINUTE, 'SHORT_WORK_DUR')).toBe('-1min'); expect(formatMeasureVariation(1529 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1.5kd'); - expect(formatMeasureVariation(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1md'); - expect(formatMeasureVariation(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('+1md'); + expect(formatMeasureVariation(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1Md'); + expect(formatMeasureVariation(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('+1Md'); }); it('should not format unknown type', () => { diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts index e1c4c46e58e..6e36fe5289c 100644 --- a/server/sonar-web/src/main/js/helpers/measures.ts +++ b/server/sonar-web/src/main/js/helpers/measures.ts @@ -164,7 +164,7 @@ function intVariationFormatter(value: number): string { function shortIntFormatter(value: number): string { if (value >= 1e9) { - return numberFormatter(value / 1e9) + translate('short_number_suffix.b'); + return numberFormatter(value / 1e9) + translate('short_number_suffix.g'); } else if (value >= 1e6) { return numberFormatter(value / 1e6) + translate('short_number_suffix.m'); } else if (value >= 1e4) { |