refactor material prices

This commit is contained in:
Martin
2016-11-01 14:39:59 +01:00
parent bf9fc3ae5a
commit 0663bedc80
7 changed files with 79 additions and 51 deletions
+4 -3
View File
@@ -2,7 +2,7 @@ from flask import Blueprint, request, jsonify, abort
from api.models.product import Material
from api.models.contract_customer import ContractCustomer
from api.models import market as market_model
from api.lib.prices import wallpaper_price, old_canvas_price, old_canvas_diy_frame_price
from api.lib.prices import wallpaper_price, old_canvas_price, old_canvas_diy_frame_price, material_price
from api.lib.limits import calculate_canvas_limits
from api.validators import validate_territory, validate_number, validate_keys_exists
@@ -36,7 +36,8 @@ def wallpaper():
data.append({
'material': material.name,
'material_id': material.id,
'price': wallpaper_price(width, height, material.price, market, reseller=reseller),
'material_price': material_price(material, market, reseller=reseller, inc_vat=True),
'price': wallpaper_price(width, height, material, market, reseller=reseller),
})
return jsonify(data=data)
@@ -63,7 +64,7 @@ def canvas():
'framed': framed,
'width': width,
'height': height,
'price': old_canvas_price(width, height, material.price, market, reseller=reseller, framed=framed)
'price': old_canvas_price(width, height, material, market, reseller=reseller, framed=framed)
})
return jsonify(data=data)