From 9a4d2781c83ac0756437bab3b42b365cb0e838bf Mon Sep 17 00:00:00 2001 From: lalanza808 Date: Mon, 6 Jan 2020 14:43:31 -0800 Subject: [PATCH] include platform fee in bid list so it's clearly shown before sale --- items/templatetags/__init__.py | 0 items/templatetags/determine_platform_fee.py | 11 +++++++++++ web/static/css/style.css | 1 - web/templates/items/get_item.html | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 items/templatetags/__init__.py create mode 100644 items/templatetags/determine_platform_fee.py diff --git a/items/templatetags/__init__.py b/items/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/items/templatetags/determine_platform_fee.py b/items/templatetags/determine_platform_fee.py new file mode 100644 index 0000000..5efd322 --- /dev/null +++ b/items/templatetags/determine_platform_fee.py @@ -0,0 +1,11 @@ +from math import ceil +from django import template +from django.conf import settings + + +register = template.Library() + +@register.filter(is_safe=True) +def determine_platform_fee(value): + platform_fee_xmr = float(value * (settings.PLATFORM_FEE_PERCENT / 100)) + return round(platform_fee_xmr, 4) diff --git a/web/static/css/style.css b/web/static/css/style.css index faa9db3..725100d 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -1154,6 +1154,5 @@ New color: fd4e05 } html { - background-color: #202222; min-height: 100%; } diff --git a/web/templates/items/get_item.html b/web/templates/items/get_item.html index 5a2df7d..2fae2e4 100644 --- a/web/templates/items/get_item.html +++ b/web/templates/items/get_item.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load determine_platform_fee %} {% block content %} @@ -42,6 +43,7 @@ Bid ID Bidder Bid Price (XMR) + Platform Fees (XMR) Bid Accepted Location Actions @@ -51,6 +53,7 @@ #{{ bid.id }} {{ bid.bidder }} {{ bid.bid_price_xmr }} + {{ bid.bid_price_xmr | determine_platform_fee }} {{ bid.accepted }} {{ bid.bidder.profile.first.city }}, {{ bid.bidder.profile.first.state }}, {{ bid.bidder.profile.first.country }}