@@ -357,10 +357,7 @@ def get_price_id_list(self, package_keyname, item_keynames, core=None):
357357 # can take that ID and create the proper price for us in the location
358358 # in which the order is made
359359 if matching_item ['itemCategory' ]['categoryCode' ] != "gpu0" :
360- price_id = None
361- for price in matching_item ['prices' ]:
362- if not price ['locationGroupId' ]:
363- price_id = self .get_item_price_id (core , price , price_id )
360+ price_id = self .get_item_price_id (core , matching_item ['prices' ])
364361 else :
365362 # GPU items has two generic prices and they are added to the list
366363 # according to the number of gpu items added in the order.
@@ -374,19 +371,17 @@ def get_price_id_list(self, package_keyname, item_keynames, core=None):
374371 return prices
375372
376373 @staticmethod
377- def get_item_price_id (core , price , price_id ):
374+ def get_item_price_id (core , prices ):
378375 """get item price id"""
379- category_code = []
380- capacity_min = int (price .get ('capacityRestrictionMinimum' , - 1 ))
381- capacity_max = int (price .get ('capacityRestrictionMaximum' , - 1 ))
382- if capacity_min == - 1 :
383- if price ['categories' ][0 ]['categoryCode' ] not in category_code :
384- category_code .append (price ['categories' ][0 ]['categoryCode' ])
385- price_id = price ['id' ]
386- elif capacity_min <= int (core ) <= capacity_max :
387- if price ['categories' ][0 ]['categoryCode' ] not in category_code :
388- category_code .append (price ['categories' ][0 ]['categoryCode' ])
389- price_id = price ['id' ]
376+ price_id = None
377+ for price in prices :
378+ if not price ['locationGroupId' ]:
379+ capacity_min = int (price .get ('capacityRestrictionMinimum' , - 1 ))
380+ capacity_max = int (price .get ('capacityRestrictionMaximum' , - 1 ))
381+ if capacity_min == - 1 :
382+ price_id = price ['id' ]
383+ elif capacity_min <= int (core ) <= capacity_max :
384+ price_id = price ['id' ]
390385 return price_id
391386
392387 def get_preset_prices (self , preset ):
0 commit comments