| Line 19... |
Line 19... |
| 19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
| 20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
| 21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
| 22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
| 23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, MarketPlaceUpdateHistory, \
|
23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, MarketPlaceUpdateHistory, \
|
| 24 |
SourceCategoryPercentage, MarketPlaceHistory
|
24 |
SourceCategoryPercentage, MarketPlaceHistory, PrivateDeals
|
| 25 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
25 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 26 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
26 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 27 |
StorePricing as tStorePricing, CatalogServiceException, \
|
27 |
StorePricing as tStorePricing, CatalogServiceException, \
|
| 28 |
BannerType, InsurerType, Banner as t_banner
|
28 |
BannerType, InsurerType, Banner as t_banner
|
| 29 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
29 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| Line 2641... |
Line 2641... |
| 2641 |
return len(session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(or_(MarketPlaceHistory.toGroup==True,MarketPlaceHistory.toGroup==None)).all())
|
2641 |
return len(session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(or_(MarketPlaceHistory.toGroup==True,MarketPlaceHistory.toGroup==None)).all())
|
| 2642 |
|
2642 |
|
| 2643 |
def get_marketplace_history_by_date(source,startDate,endDate,offset,limit,itemId):
|
2643 |
def get_marketplace_history_by_date(source,startDate,endDate,offset,limit,itemId):
|
| 2644 |
return session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(MarketPlaceHistory.timestamp > to_py_date(startDate)).filter(MarketPlaceHistory.timestamp < to_py_date(endDate)).order_by(desc(MarketPlaceHistory.timestamp)).all()
|
2644 |
return session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(MarketPlaceHistory.timestamp > to_py_date(startDate)).filter(MarketPlaceHistory.timestamp < to_py_date(endDate)).order_by(desc(MarketPlaceHistory.timestamp)).all()
|
| 2645 |
|
2645 |
|
| - |
|
2646 |
def get_private_deal_details(itemid):
|
| - |
|
2647 |
return PrivateDeals.get_by(item_id=itemid)
|
| - |
|
2648 |
|
| - |
|
2649 |
def get_private_deal_items(offset,limit):
|
| - |
|
2650 |
print session.query(Item).join((PrivateDeals,Item.id==PrivateDeals.item_id)).offset(offset).limit(limit).all()
|
| - |
|
2651 |
return session.query(Item).join((PrivateDeals,Item.id==PrivateDeals.item_id)).offset(offset).limit(limit).all()
|
| - |
|
2652 |
|
| - |
|
2653 |
def add_or_update_private_deal(privatedeal):
|
| 2646 |
|
2654 |
try:
|
| - |
|
2655 |
deal = PrivateDeals.get_by(item_id=privatedeal.item_id)
|
| - |
|
2656 |
if deal is None:
|
| - |
|
2657 |
deal = PrivateDeals()
|
| - |
|
2658 |
deal.item_id = privatedeal.item_id
|
| - |
|
2659 |
deal.dealFreebieItemId = privatedeal.dealFreebieItemId
|
| - |
|
2660 |
deal.dealPrice = privatedeal.dealPrice
|
| - |
|
2661 |
deal.startDate = privatedeal.startDate
|
| - |
|
2662 |
deal.endDate = privatedeal.endDate
|
| - |
|
2663 |
deal.isDealTextIdentical = privatedeal.isDealTextIdentical
|
| - |
|
2664 |
deal.dealText = privatedeal.dealText
|
| - |
|
2665 |
deal.isCod = privatedeal.isCod
|
| - |
|
2666 |
deal.rank = privatedeal.rank
|
| - |
|
2667 |
else:
|
| - |
|
2668 |
deal.dealFreebieItemId = privatedeal.dealFreebieItemId
|
| - |
|
2669 |
deal.dealPrice = privatedeal.dealPrice
|
| - |
|
2670 |
deal.startDate = privatedeal.startDate
|
| - |
|
2671 |
deal.endDate = privatedeal.endDate
|
| - |
|
2672 |
deal.isDealTextIdentical = privatedeal.isDealTextIdentical
|
| - |
|
2673 |
deal.dealText = privatedeal.dealText
|
| - |
|
2674 |
deal.isCod = privatedeal.isCod
|
| - |
|
2675 |
deal.rank = privatedeal.rank
|
| - |
|
2676 |
session.commit()
|
| - |
|
2677 |
return True
|
| - |
|
2678 |
except Exception as e:
|
| - |
|
2679 |
print e
|
| - |
|
2680 |
return False
|
| 2647 |
|
2681 |
|