]> source.dussan.org Git - sonarqube.git/commitdiff
Use correct metric suffix
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 28 Nov 2017 07:59:54 +0000 (08:59 +0100)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 28 Nov 2017 11:19:59 +0000 (12:19 +0100)
server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
server/sonar-web/src/main/js/helpers/measures.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index e0795b485f2f2c31e9470e0a07652086d0eeee24..e57d404eeab3023b3080d2c7eba0197257afdb72 100644 (file)
@@ -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', () => {
index e1c4c46e58ee31b6133ef7bdcebd40905443c3bf..6e36fe5289c3c136460ae40c95daed1404f19bc9 100644 (file)
@@ -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) {
index cf5916587df7217982290f6321e9abd58a36806b..32946f38725a1a8d52acab224e64bf5458d832bf 100644 (file)
@@ -218,9 +218,9 @@ no_results_search.favorites.2=Would you like to search among {url} projects?
 page_extension_failed=Page extension failed.
 set_as_default=Set as Default
 unset_as_default=Unset as Default
+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
 show_more=Show More
 should_be_unique=Should be unique
 since_x=since {0}