| Line 3398... |
Line 3398... |
| 3398 |
i.model_name = data.model_name
|
3398 |
i.model_name = data.model_name
|
| 3399 |
i.model_number = data.model_number
|
3399 |
i.model_number = data.model_number
|
| 3400 |
session.commit()
|
3400 |
session.commit()
|
| 3401 |
|
3401 |
|
| 3402 |
def get_warranty_info_for_item(itemId, itemCondition):
|
3402 |
def get_warranty_info_for_item(itemId, itemCondition):
|
| 3403 |
itemWarrantyInfo = ItemWarrantyInfo.query.filter(and_(ItemWarrantyInfo.itemId==itemId, ItemWarrantyInfo.itemCondition==itemCondition)).first()
|
3403 |
itemWarrantyInfo = ItemWarrantyInfo.query.filter(and_(ItemWarrantyInfo.catalogItemId ==itemId, ItemWarrantyInfo.itemCondition==itemCondition)).first()
|
| 3404 |
itemwarrantyinfoMap = {}
|
3404 |
itemwarrantyinfoMap = {}
|
| 3405 |
if itemWarrantyInfo is None:
|
3405 |
if itemWarrantyInfo is None:
|
| 3406 |
item = get_item(itemId)
|
3406 |
items = get_items_by_catalog_id(itemId)
|
| 3407 |
if item is None:
|
3407 |
if items is None or len(items)==0:
|
| 3408 |
raise CatalogServiceException(itemId, "Could not find item in catalog")
|
3408 |
raise CatalogServiceException(itemId, "Could not find item in catalog")
|
| - |
|
3409 |
item = items[0]
|
| 3409 |
categoryWarrantyInfo = CategoryWarrantyInfo.query.filter(and_(CategoryWarrantyInfo.categoryId==item.category, CategoryWarrantyInfo.brand==item.brand, CategoryWarrantyInfo.itemCondition==itemCondition)).first()
|
3410 |
categoryWarrantyInfo = CategoryWarrantyInfo.query.filter(and_(CategoryWarrantyInfo.categoryId==item.category, CategoryWarrantyInfo.brand==item.brand, CategoryWarrantyInfo.itemCondition==itemCondition)).first()
|
| 3410 |
if categoryWarrantyInfo is None:
|
3411 |
if categoryWarrantyInfo is None:
|
| 3411 |
raise CatalogServiceException(item.id, "Could not find warrabty info for this item id" + str(item.id) + " for " + str(ItemCondition._VALUES_TO_NAMES[itemCondition]))
|
3412 |
raise CatalogServiceException(item.id, "Could not find warranty info for this item id" + str(item.id) + " for " + str(ItemCondition._VALUES_TO_NAMES[itemCondition]))
|
| 3412 |
itemwarrantyinfoMap[categoryWarrantyInfo.warrantyPeriodType] = categoryWarrantyInfo.warrantyVal
|
3413 |
itemwarrantyinfoMap[categoryWarrantyInfo.warrantyPeriodType] = categoryWarrantyInfo.warrantyVal
|
| 3413 |
else:
|
3414 |
else:
|
| 3414 |
itemwarrantyinfoMap[itemWarrantyInfo.warrantyPeriodType] = itemWarrantyInfo.warrantyVal
|
3415 |
itemwarrantyinfoMap[itemWarrantyInfo.warrantyPeriodType] = itemWarrantyInfo.warrantyVal
|
| 3415 |
return itemwarrantyinfoMap
|
3416 |
return itemwarrantyinfoMap
|
| 3416 |
|
3417 |
|
| - |
|
3418 |
def get_warranty_info_for_item_list(itemIds, itemCondition):
|
| - |
|
3419 |
itemWarrantyMap = {}
|
| - |
|
3420 |
for itemId in itemIds:
|
| - |
|
3421 |
itemWarrantyMap[itemId] = get_warranty_info_for_item(itemId, itemCondition)
|
| - |
|
3422 |
|
| - |
|
3423 |
return itemWarrantyMap
|
| - |
|
3424 |
|
| 3417 |
if __name__=='__main__':
|
3425 |
if __name__=='__main__':
|
| 3418 |
DataService.initialize()
|
3426 |
DataService.initialize()
|
| 3419 |
#update_bulk_prices_on_production(21053,[])
|
3427 |
#update_bulk_prices_on_production(21053,[])
|
| 3420 |
print get_cart_by_value([1005394,46868158])
|
3428 |
print get_cart_by_value([1005394,46868158])
|
| 3421 |
|
3429 |
|
| 3422 |
|
3430 |
|