Add new pricing system (#65)

This commit is contained in:
Fredrik Ringqvist
2023-05-05 10:33:02 +02:00
committed by GitHub
parent 1c5bcd4471
commit 4556155a84
5 changed files with 319 additions and 12 deletions
+11 -2
View File
@@ -30,7 +30,13 @@ def get_external_print_product(id):
return external_product
def get_cheapest_canvas_product():
def get_cheapest_canvas_product(new_version):
if new_version:
# We simply return the smallest size, assuming that is also the cheapest.
# It is technically possible that a larger size is cheaper, but unlikely, so we avoid the extra complexity
# of calculating the guaranteed cheapest product.
return 'canvas_200x300-mm-8x12-inch_canvas_wood-fsc-slim_4-0_ver'
sql = "select external_product_id from external_print_products where group_id = 2 order by price_sek limit 1"
result = db.session.execute(sql)
external_id = result.first()[0]
@@ -38,7 +44,10 @@ def get_cheapest_canvas_product():
return external_id
def get_cheapest_poster_product():
def get_cheapest_poster_product(new_version):
if new_version:
return 'flat_250x250-mm-10x10-inch_200-gsm-80lb-uncoated_4-0_ver'
sql = "select external_product_id from external_print_products where group_id in (7,8) order by price_sek limit 1"
result = db.session.execute(sql)
external_id = result.first()[0]