Browse Source

Use correct metric suffix

tags/7.0-RC1
Grégoire Aubert 6 years ago
parent
commit
5880d0c5b4

+ 7
- 7
server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts View 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', () => {

+ 1
- 1
server/sonar-web/src/main/js/helpers/measures.ts View 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) {

+ 2
- 2
sonar-core/src/main/resources/org/sonar/l10n/core.properties View 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}

Loading…
Cancel
Save