Skip to content

Commit d1ece32

Browse files
authored
fix: consider decimal rating for Firefox extension (#11068)
1 parent 1c074f4 commit d1ece32

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

services/amo/amo-rating.service.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ export default class AmoRating extends BaseAmoService {
2727
static _cacheLength = 7200
2828

2929
static render({ format, rating }) {
30-
rating = Math.round(rating)
3130
return {
3231
label: format,
33-
message: format === 'stars' ? starRating(rating) : `${rating}/5`,
32+
message:
33+
format === 'stars'
34+
? starRating(rating)
35+
: `${Math.round(rating * 10) / 10}/5`,
3436
color: floorCountColor(rating, 2, 3, 4),
3537
}
3638
}

services/amo/amo-rating.tester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ t.create('Rating')
77
.get('/rating/IndieGala-Helper.json')
88
.expectBadge({
99
label: 'rating',
10-
message: Joi.string().regex(/^\d\/\d$/),
10+
message: Joi.string().regex(/^\d(\.\d)?\/\d$/),
1111
})
1212

1313
t.create('Stars')

0 commit comments

Comments
 (0)