fix: format amount on course cards
This commit is contained in:
@@ -189,7 +189,8 @@ jinja = {
|
|||||||
"lms.lms.utils.is_instructor",
|
"lms.lms.utils.is_instructor",
|
||||||
"lms.lms.utils.convert_number_to_character",
|
"lms.lms.utils.convert_number_to_character",
|
||||||
"lms.lms.utils.get_signup_optin_checks",
|
"lms.lms.utils.get_signup_optin_checks",
|
||||||
"lms.lms.utils.get_popular_courses"
|
"lms.lms.utils.get_popular_courses",
|
||||||
|
"lms.lms.utils.format_amount"
|
||||||
],
|
],
|
||||||
"filters": []
|
"filters": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, cint, cstr, getdate, add_months
|
from frappe.utils import flt, cint, cstr, getdate, add_months, fmt_money
|
||||||
from lms.lms.md import markdown_to_html, find_macros
|
from lms.lms.md import markdown_to_html, find_macros
|
||||||
import string
|
import string
|
||||||
from frappe import _
|
from frappe import _
|
||||||
@@ -366,3 +366,10 @@ def get_evaluation_details(course, member=None):
|
|||||||
"request": request,
|
"request": request,
|
||||||
"no_of_attempts": no_of_attempts
|
"no_of_attempts": no_of_attempts
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def format_amount(amount, currency):
|
||||||
|
amount_reduced = amount / 1000
|
||||||
|
if amount_reduced < 1:
|
||||||
|
return amount
|
||||||
|
precision = 0 if amount % 1000 == 0 else 1
|
||||||
|
return _("{0}K").format(fmt_money(amount_reduced, precision, currency))
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
{% if course.paid_certificate %}
|
{% if course.paid_certificate %}
|
||||||
<div class="certificate-price small mt-3" data-price="{{ course.price_certificate }}">
|
<div class="certificate-price small mt-3" data-price="{{ course.price_certificate }}">
|
||||||
{{ _("Certificate Price: ") }} {{ frappe.utils.fmt_money(course.price_certificate, 2, course.currency) }}
|
{{ _("Certificate Price: {0}").format(format_amount(course.price_certificate, course.currency)) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user