Rounded MRR in dashboard

refs https://github.com/TryGhost/Team/issues/1602

- Added `cents` option to ghPriceAmount helper.
- Removed cents from MRR in dashboard.
This commit is contained in:
Simon Backx 2022-05-10 17:35:51 +02:00
parent 53c93f7fd7
commit 2b4e80b3dd
3 changed files with 6 additions and 6 deletions

View File

@ -78,7 +78,7 @@ export default class Mrr extends Component {
return '-';
}
const valueText = ghPriceAmount(this.currentMRR);
const valueText = ghPriceAmount(this.currentMRR, {cents: false});
return `${this.mrrCurrencySymbol}${valueText}`;
}

View File

@ -1,9 +1,9 @@
import {formatNumber} from './format-number';
import {helper} from '@ember/component/helper';
export function ghPriceAmount(amount) {
export function ghPriceAmount(amount, {cents = true} = {}) {
if (amount) {
let price = amount / 100;
let price = cents ? amount / 100 : Math.round(amount / 100);
if (price % 1 === 0) {
return formatNumber(price);
} else {
@ -14,6 +14,6 @@ export function ghPriceAmount(amount) {
}
// like {{pluralize}} but formats the number according to current locale
export default helper(function ([amount]) {
return ghPriceAmount(amount);
export default helper(function ([amount], options = {}) {
return ghPriceAmount(amount, options);
});

View File

@ -395,7 +395,7 @@ export default class DashboardMocksService extends Service {
this.mrrStats = stats.map((s) => {
return {
date: s.date,
mrr: s.tier1 * 500 + s.tier2 * 2500,
mrr: s.tier1 * 501 + s.tier2 * 2500,
currency: 'usd'
};
});