Merge branch 'formatting-big-numbers' into 'master'

use comas in big numbers throughout codebase

See merge request engineering/make-post-sell/make_post_sell!25
This commit is contained in:
Russell Ballestrini 2024-06-25 14:34:41 +00:00
commit 123dd2d145
9 changed files with 22 additions and 22 deletions

View file

@ -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):

View file

@ -74,7 +74,7 @@
<a href="{{ request.route_url('join-or-log-in', _query={'next': request.url}) }}">My Account</a>
{% endif %}
<a href="/cart" class="cart-and-count">&#128722; Cart ${{ '%0.2f' % request.active_cart.total }} ({{ request.active_cart.count }})</a>
<a href="/cart" class="cart-and-count">&#128722; Cart ${{ "{:,.2f}".format(request.active_cart.total) }} ({{ "{:,}".format(request.active_cart.count) }})</a>
</section>

View file

@ -112,7 +112,7 @@
<form action="/cart/{{ cart.id }}/quantity" method="POST" onsubmit="submit.disabled = true; return true;" style="display: inline;">
<input type="hidden" name="product_id" value="{{ product.id }}">
quantity: <input type="text" name="quantity" class="mps-quantity" value="{{ product_quantity }}">
quantity: <input type="text" name="quantity" class="mps-quantity" value="{{ "{:,}".format(product_quantity) }}">
<input type="submit" id="submit" value="update" role="button" style="width: 80px;"/>
</form>
<br/>
@ -122,9 +122,9 @@
</div>
<div style="text-align: right;">
<span class="opacity-60">{{ product_quantity }} x ${{ '%0.2f' % product.price }}</span>
<span class="opacity-60">{{ "{:,}".format(product_quantity) }} x ${{ "{:,.2f}".format(product.price) }}</span>
<br/>
<b>${{ '%0.2f' % line_total }}</b>
<b>${{ "{:,.2f}".format(line_total) }}</b>
<br/>
</div>
@ -140,15 +140,15 @@
{% endif %}
{% if request.shop_location.local_delivery %}
<input type="radio" id="local_delivery" name="handling_option" value="local_delivery" {% if cart.handling_option == "local_delivery" %}checked{% endif %} required>
<label for="local_delivery" style="display: inline;">Local Delivery (${{ '%0.2f' % request.shop_location.local_delivery_rate }})</label><br>
<label for="local_delivery" style="display: inline;">Local Delivery (${{ '{:,.2f}'.format(request.shop_location.local_delivery_rate) }})</label><br>
{% endif %}
{% if request.shop_location.local_shipping %}
<input type="radio" id="local_shipping" name="handling_option" value="local_shipping" {% if cart.handling_option == "local_shipping" %}checked{% endif %} required>
<label for="local_shipping" style="display: inline;">Local Shipping (${{ '%0.2f' % request.shop_location.local_shipping_rate }})</label><br>
<label for="local_shipping" style="display: inline;">Local Shipping (${{ '{:,.2f}'.format(request.shop_location.local_shipping_rate) }})</label><br>
{% endif %}
{% if request.shop_location.international_shipping %}
<input type="radio" id="international_shipping" name="handling_option" value="international_shipping" {% if cart.handling_option == "international_shipping" %}checked{% endif %} required>
<label for="international_shipping" style="display: inline;">International Shipping (${{ '%0.2f' % request.shop_location.international_shipping_rate }})</label><br>
<label for="international_shipping" style="display: inline;">International Shipping (${{ '{:,.2f}'.format(request.shop_location.international_shipping_rate) }})</label><br>
{% endif %}
<input type="submit" value="Set Handling Option">
</form>
@ -158,11 +158,11 @@
<div style="text-align: right; grid-column: span 3">
{% if cart.is_discounted %}
<b style="font-size: 1.5em;"><s>${{ '%0.2f' % cart.shop_totals[shop.uuid_str] }}</s></b>
<b style="font-size: 1.5em;"><s>${{ '{:,.2f}'.format(cart.shop_totals[shop.uuid_str]) }}</s></b>
<br/>
<b class="discounted" style="font-size: 1.5em;">${{ '%0.2f' % discounted_shop_totals[shop.uuid_str] }}</b>
<b class="discounted" style="font-size: 1.5em;">${{ '{:,.2f}'.format(discounted_shop_totals[shop.uuid_str]) }}</b>
{% else %}
<b style="font-size: 1.5em;">${{ '%0.2f' % cart.shop_totals[shop.uuid_str] }}</b>
<b style="font-size: 1.5em;">${{ '{:,.2f}'.format(cart.shop_totals[shop.uuid_str]) }}</b>
{% endif %}
</div>
@ -189,11 +189,11 @@
<section class="cart-right well">
{% if cart.is_discounted %}
<h2>Total: <s>${{ '%0.2f' % cart.total_price }}</s>
<span class="discounted">${{ '%0.2f' % total_discounted_price }}
<h2>Total: <s>${{ '{:,.2f}'.format(cart.total_price) }}</s>
<span class="discounted">${{ '{:,.2f}'.format(total_discounted_price) }}
</h2></span>
{% else %}
<h2>Total: ${{ '%0.2f' % cart.total }}</h2>
<h2>Total: ${{ '{:,.2f}'.format(cart.total) }}</h2>
{% endif %}
{% if not cart.is_empty and request.user == cart.user %}

View file

@ -22,11 +22,11 @@
<section class="checkout-right well">
<h2>Cart Total: ${{ '%0.2f' % cart.total }}</h2>
<h2>Cart Total: ${{ '{:,.2f}'.format(cart.total) }}</h2>
<br/>
Are you sure you want to charge <br/>
<b>${{ '%0.2f' % cart.total }}</b> to your active credit card?
<b>${{ '{:,.2f}'.format(cart.total) }}</b> to your active credit card?
<br/>
<br/>

View file

@ -49,7 +49,7 @@
<b><a href="{{ product.absolute_url(request) }}" class="shop_theme_link_color">{{ product.title }}</a></b>
{% if product.is_sellable %}
<br>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '%0.2f' % product.price }}</a>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '{:,.2f}'.format(product.price) }}</a>
{% endif %}
<br />
<a href="{{ product.shop.absolute_url(request) }}" rel="nofollow">{{ product.shop.name }}</a>

View file

@ -55,7 +55,7 @@
<br>
<div class="well">
<h1>${{ '%0.2f' % product.price }}</h1>
<h1>${{ '{:,.2f}'.format(product.price) }}</h1>
{% if product.is_ready %}

View file

@ -23,7 +23,7 @@
<b><a href="{{ product.absolute_url(request) }}" class="shop_theme_link_color">{{ product.title }}</a></b>
{% if product.is_sellable %}
<br />
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '%0.2f' % product.price }}</a>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '{:,.2f}'.format(product.price) }}</a>
{% endif %}
<br>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">{{ product.shop.name }}</a>

View file

@ -16,7 +16,7 @@
<b><a href="{{ product.absolute_url(request) }}">{{ product.title }}</a></b>
{% if product.is_sellable %}
<br />
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '%0.2f' % product.price }}</a>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '{:,.2f}'.format(product.price) }}</a>
{% endif %}
<br>
<a href="{{ product.absolute_url(request) }}" rel="nofollow">{{ product.shop.name }}</a>

View file

@ -17,7 +17,7 @@ tr { text-align: left;}
<tr>
<td>{{ product.is_sellable }}</td>
<td><a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '%0.2f' % product.price }}</a></td>
<td><a href="{{ product.absolute_url(request) }}" rel="nofollow">${{ '{:,.2f}'.format(product.price) }}</a></td>
<td>{{ product.human_visibility }}</td>
<td>{{ product.is_bundle }}</td>
<td>{{ product.is_physical }}</td>