P5-3075 - Change price caluclation for the largest canvases
This commit is contained in:
@@ -46,3 +46,9 @@ Starting the application:
|
||||
Running the eSales import
|
||||
|
||||
`$ python manage.py run_esales_import`
|
||||
|
||||
## Testing
|
||||
|
||||
To run unit tests:
|
||||
|
||||
`$ python -m unittest`
|
||||
|
||||
+13
-1
@@ -78,6 +78,14 @@ def canvas_cm2_price(cm2):
|
||||
return cm2_price
|
||||
|
||||
|
||||
def package_price(width, height, market):
|
||||
longest_side = max(width, height)
|
||||
if longest_side > 119 and market.territory in ['US', 'EU']:
|
||||
return 800
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def canvas_price(width, height, market, framed=True, designer=None, reseller=None, inquiry=None, rounded=True, inc_vat=True):
|
||||
cm2 = width * height
|
||||
|
||||
@@ -90,6 +98,11 @@ def canvas_price(width, height, market, framed=True, designer=None, reseller=Non
|
||||
if not framed:
|
||||
price *= 0.7
|
||||
|
||||
price *= market.price_adjustments
|
||||
|
||||
# Package price should be added after market price adjustment but before other price adjustments.
|
||||
price += package_price(width, height, market)
|
||||
|
||||
if designer:
|
||||
price *= (float(designer.pricepremium) / 100) + 1
|
||||
|
||||
@@ -100,7 +113,6 @@ def canvas_price(width, height, market, framed=True, designer=None, reseller=Non
|
||||
price *= (float(inquiry.pricepremium) / 100) + 1
|
||||
|
||||
price *= market.exchange_rate
|
||||
price *= market.price_adjustments
|
||||
|
||||
if inc_vat:
|
||||
price *= market.vat
|
||||
|
||||
Vendored
+4
-1
@@ -1,9 +1,10 @@
|
||||
from fabric.api import *
|
||||
|
||||
env.user = 'ubuntu'
|
||||
env.key_filename = '~/.ssh/ukad.pem'
|
||||
|
||||
env.hosts = (
|
||||
'ec2-52-51-154-66.eu-west-1.compute.amazonaws.com',
|
||||
'ec2-52-51-154-66.eu-west-1.compute.amazonaws.com', #api2-dev
|
||||
)
|
||||
|
||||
|
||||
@@ -14,5 +15,7 @@ def deploy():
|
||||
with cd('/srv/api'):
|
||||
run('tar xzf /tmp/api.tar.gz')
|
||||
run('rm /tmp/api.tar.gz')
|
||||
sudo('service nginx stop')
|
||||
sudo('service api-uwsgi restart')
|
||||
sudo('service nginx start')
|
||||
local('rm /tmp/api.tar.gz')
|
||||
|
||||
+3
-1
@@ -11,4 +11,6 @@ psycopg2==2.6.1
|
||||
Flask-Testing==0.5.0
|
||||
unittest2==1.1.0
|
||||
factory-boy==2.7.0
|
||||
jsonschema==2.5.1
|
||||
jsonschema==2.5.1
|
||||
mock==2.0.0
|
||||
Faker==0.9.0
|
||||
|
||||
@@ -137,6 +137,9 @@ class TestPrice(unittest2.TestCase):
|
||||
self.assertEqual(1800, canvas_price(width=150, height=150,
|
||||
market=sweden, framed=True, inc_vat=True))
|
||||
|
||||
self.assertEqual(277, canvas_price(width=150, height=150,
|
||||
market=us, framed=True, inc_vat=True))
|
||||
|
||||
self.assertEqual(672, canvas_price(
|
||||
width=100, height=100, market=sweden, framed=False, inc_vat=False))
|
||||
|
||||
@@ -240,3 +243,7 @@ class TestPrice(unittest2.TestCase):
|
||||
# it does not add dealer_store.pricepremium to the frame price
|
||||
self.assertEqual(131, inquiry_price(inquiry))
|
||||
self.assertEqual(91, inquiry_price(inquiry, framed=False))
|
||||
|
||||
def test_package_price(self):
|
||||
self.assertEqual(800, package_price(150, 40, market=us))
|
||||
self.assertEqual(0, package_price(150, 40, market=sweden))
|
||||
|
||||
Reference in New Issue
Block a user