format the rate in the plan model

This commit is contained in:
Rimian Perkins
2019-10-31 10:44:46 +11:00
parent dbaa30ba18
commit 842fac9176
2 changed files with 25 additions and 1 deletions
@@ -1,6 +1,13 @@
import computed from "ember-addons/ember-computed-decorators";
import { ajax } from "discourse/lib/ajax";
const Plan = Discourse.Model.extend({});
const Plan = Discourse.Model.extend({
@computed("amount", "currency", "interval")
subscriptionRate(amount, currency, interval) {
const dollars = parseFloat(amount / 100).toFixed(2);
return `$${dollars} ${currency.toUpperCase()} / ${interval}`;
},
});
Plan.reopenClass({
findAll() {