Example #1
0
    def test_util_sanity(self):
        fabric_complexity_factor = 12345.12
        product_base_price = 1234567890.12
        complication_element_base_price = [12345.12, 1.02, 1, 0.55]
        complication_element_complexity = [123.12, 1, 2, 3]
        order_processing_category = 1
        allowance_discount_coefficients = [12345.12, 1.01, 99.99]

        result = order_price_calculation(fabric_complexity_factor,
                                         product_base_price,
                                         complication_element_base_price,
                                         complication_element_complexity,
                                         order_processing_category,
                                         allowance_discount_coefficients)
        self.assertEqual(result, '227926471619334944.00')
Example #2
0
    def test_util_sanity_simple(self):
        fabric_complexity_factor = 1
        product_base_price = 750
        complication_element_base_price = [30, 30, 30, 30, 30, 30, 30, 30, 30]
        complication_element_complexity = [1, 1, 1, 1, 1, 1, 1, 1, 1]
        order_processing_category = 1
        allowance_discount_coefficients = []

        result = order_price_calculation(fabric_complexity_factor,
                                         product_base_price,
                                         complication_element_base_price,
                                         complication_element_complexity,
                                         order_processing_category,
                                         allowance_discount_coefficients)
        self.assertEqual(result, '1224.00')
Example #3
0
def order_price_tag(order):
    complication_elements_base_price_list = []
    complication_elements_complexity_list = []
    allowance_discount_coefficient_list = []

    for i in order.complication_elements.all():
        complication_elements_base_price_list.append(i.base_price)
        complication_elements_complexity_list.append(i.complexity)

    for k in order.allowance_discount.all():
        allowance_discount_coefficient_list.append(k.coefficient)

    return order_price_calculation(order.fabric.complexity_factor,
                                   order.product.base_price,
                                   complication_elements_base_price_list,
                                   complication_elements_complexity_list,
                                   order.processing_category,
                                   allowance_discount_coefficient_list)
Example #4
0
    def get_order_price(self):
        '''
        there is three calculation methods
        '''
        order = self.object
        complication_elements_base_price_list = []
        complication_elements_complexity_list = []
        allowance_discount_coefficient_list = []

        for i in order.complication_elements.all():
            complication_elements_base_price_list.append(i.base_price)

        for j in order.complication_elements.all():
            complication_elements_complexity_list.append(j.complexity)

        for k in order.allowance_discount.all():
            allowance_discount_coefficient_list.append(k.coefficient)

        return order_price_calculation(order.fabric.complexity_factor,
                                       order.product.base_price,
                                       complication_elements_base_price_list,
                                       complication_elements_complexity_list,
                                       order.processing_category,
                                       allowance_discount_coefficient_list)