From dace1684c8a8218d24189da1f9c1ab027b64646d Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Tue, 25 Jun 2024 14:34:40 +0000 Subject: [PATCH] use comas in big numbers throughout codebase --- make_post_sell/models/coupon.py | 4 ++-- make_post_sell/templates/base.j2 | 2 +- make_post_sell/templates/cart.j2 | 24 +++++++++++------------ make_post_sell/templates/cart_checkout.j2 | 4 ++-- make_post_sell/templates/home.j2 | 2 +- make_post_sell/templates/product.j2 | 2 +- make_post_sell/templates/products.j2 | 2 +- make_post_sell/templates/shop.j2 | 2 +- make_post_sell/templates/shop_products.j2 | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/make_post_sell/models/coupon.py b/make_post_sell/models/coupon.py index 1adca5d..df56188 100644 --- a/make_post_sell/models/coupon.py +++ b/make_post_sell/models/coupon.py @@ -161,7 +161,7 @@ class Coupon(RBase, Base): def human_discount(self): if self.action_type == "percent-off": return f"{int(self.action_value * 100)}% off" - return f"${cents_to_dollars(self.action_value):.2f} off" + return f"${cents_to_dollars(self.action_value):,.2f} off" @property def human_max_redemptions(self): @@ -185,7 +185,7 @@ class Coupon(RBase, Base): @property def human_minimum_cart(self): if self.cart_qualifier: - return f"any ${cents_to_dollars(self.cart_qualifier):.0f} cart." + return f"any ${cents_to_dollars(self.cart_qualifier):,.2f} cart." return "any cart." def compute_discount(self, cents): diff --git a/make_post_sell/templates/base.j2 b/make_post_sell/templates/base.j2 index 7a359c0..47db2d8 100644 --- a/make_post_sell/templates/base.j2 +++ b/make_post_sell/templates/base.j2 @@ -74,7 +74,7 @@ My Account {% endif %} - 🛒 Cart ${{ '%0.2f' % request.active_cart.total }} ({{ request.active_cart.count }}) + 🛒 Cart ${{ "{:,.2f}".format(request.active_cart.total) }} ({{ "{:,}".format(request.active_cart.count) }}) diff --git a/make_post_sell/templates/cart.j2 b/make_post_sell/templates/cart.j2 index 3227271..cdd8dd0 100644 --- a/make_post_sell/templates/cart.j2 +++ b/make_post_sell/templates/cart.j2 @@ -112,7 +112,7 @@
- quantity: + quantity:

@@ -122,9 +122,9 @@
- {{ product_quantity }} x ${{ '%0.2f' % product.price }} + {{ "{:,}".format(product_quantity) }} x ${{ "{:,.2f}".format(product.price) }}
- ${{ '%0.2f' % line_total }} + ${{ "{:,.2f}".format(line_total) }}
@@ -140,15 +140,15 @@ {% endif %} {% if request.shop_location.local_delivery %} -
+
{% endif %} {% if request.shop_location.local_shipping %} -
+
{% endif %} {% if request.shop_location.international_shipping %} -
+
{% endif %} @@ -158,11 +158,11 @@
{% if cart.is_discounted %} - ${{ '%0.2f' % cart.shop_totals[shop.uuid_str] }} + ${{ '{:,.2f}'.format(cart.shop_totals[shop.uuid_str]) }}
- ${{ '%0.2f' % discounted_shop_totals[shop.uuid_str] }} + ${{ '{:,.2f}'.format(discounted_shop_totals[shop.uuid_str]) }} {% else %} - ${{ '%0.2f' % cart.shop_totals[shop.uuid_str] }} + ${{ '{:,.2f}'.format(cart.shop_totals[shop.uuid_str]) }} {% endif %}
@@ -189,11 +189,11 @@
{% if cart.is_discounted %} -

Total: ${{ '%0.2f' % cart.total_price }} - ${{ '%0.2f' % total_discounted_price }} +

Total: ${{ '{:,.2f}'.format(cart.total_price) }} + ${{ '{:,.2f}'.format(total_discounted_price) }}

{% else %} -

Total: ${{ '%0.2f' % cart.total }}

+

Total: ${{ '{:,.2f}'.format(cart.total) }}

{% endif %} {% if not cart.is_empty and request.user == cart.user %} diff --git a/make_post_sell/templates/cart_checkout.j2 b/make_post_sell/templates/cart_checkout.j2 index 937ac86..1b32ad5 100644 --- a/make_post_sell/templates/cart_checkout.j2 +++ b/make_post_sell/templates/cart_checkout.j2 @@ -22,11 +22,11 @@
-

Cart Total: ${{ '%0.2f' % cart.total }}

+

Cart Total: ${{ '{:,.2f}'.format(cart.total) }}


Are you sure you want to charge
- ${{ '%0.2f' % cart.total }} to your active credit card? + ${{ '{:,.2f}'.format(cart.total) }} to your active credit card?

diff --git a/make_post_sell/templates/home.j2 b/make_post_sell/templates/home.j2 index 7f4e57f..633476b 100644 --- a/make_post_sell/templates/home.j2 +++ b/make_post_sell/templates/home.j2 @@ -49,7 +49,7 @@ {{ product.title }} {% if product.is_sellable %}
- ${{ '%0.2f' % product.price }} + ${{ '{:,.2f}'.format(product.price) }} {% endif %}
{{ product.shop.name }} diff --git a/make_post_sell/templates/product.j2 b/make_post_sell/templates/product.j2 index 4fa3d33..c07b2e3 100644 --- a/make_post_sell/templates/product.j2 +++ b/make_post_sell/templates/product.j2 @@ -55,7 +55,7 @@
-

${{ '%0.2f' % product.price }}

+

${{ '{:,.2f}'.format(product.price) }}

{% if product.is_ready %} diff --git a/make_post_sell/templates/products.j2 b/make_post_sell/templates/products.j2 index 1902a42..8c72d34 100644 --- a/make_post_sell/templates/products.j2 +++ b/make_post_sell/templates/products.j2 @@ -23,7 +23,7 @@ {{ product.title }} {% if product.is_sellable %}
- ${{ '%0.2f' % product.price }} + ${{ '{:,.2f}'.format(product.price) }} {% endif %}
{{ product.shop.name }} diff --git a/make_post_sell/templates/shop.j2 b/make_post_sell/templates/shop.j2 index 1eb7edb..771a5a2 100644 --- a/make_post_sell/templates/shop.j2 +++ b/make_post_sell/templates/shop.j2 @@ -16,7 +16,7 @@ {{ product.title }} {% if product.is_sellable %}
- ${{ '%0.2f' % product.price }} + ${{ '{:,.2f}'.format(product.price) }} {% endif %}
{{ product.shop.name }} diff --git a/make_post_sell/templates/shop_products.j2 b/make_post_sell/templates/shop_products.j2 index a860f6e..1d66187 100644 --- a/make_post_sell/templates/shop_products.j2 +++ b/make_post_sell/templates/shop_products.j2 @@ -17,7 +17,7 @@ tr { text-align: left;} {{ product.is_sellable }} - ${{ '%0.2f' % product.price }} + ${{ '{:,.2f}'.format(product.price) }} {{ product.human_visibility }} {{ product.is_bundle }} {{ product.is_physical }}