Example #1
0
    def get_total_weight(self):
        total_weight = 0

        for item in self.items:
            total_weight += item.weight

        return set_to_decimal(total_weight, self.number_of_decimals)
Example #2
0
    def get_filling_ratio(self):
        total_filling_volume = 0
        total_filling_ratio = 0

        for item in self.items:
            total_filling_volume += item.get_volume()

        total_filling_ratio = total_filling_volume / self.get_volume()
        return set_to_decimal(total_filling_ratio, self.number_of_decimals)
Example #3
0
 def format_numbers(self, number_of_decimals):
     self.length = set_to_decimal(self.length, number_of_decimals)
     self.height = set_to_decimal(self.height, number_of_decimals)
     self.width = set_to_decimal(self.width, number_of_decimals)
     self.capacity = set_to_decimal(self.capacity, number_of_decimals)
     self.number_of_decimals = number_of_decimals
Example #4
0
 def get_volume(self):
     return set_to_decimal(self.length * self.height * self.width,
                           self.number_of_decimals)
Example #5
0
 def format_numbers(self, number_of_decimals):
     self.width = set_to_decimal(self.width, number_of_decimals)
     self.height = set_to_decimal(self.height, number_of_decimals)
     self.depth = set_to_decimal(self.depth, number_of_decimals)
     self.max_weight = set_to_decimal(self.max_weight, number_of_decimals)
     self.number_of_decimals = number_of_decimals