| Line 5... |
Line 5... |
| 5 |
from shop2020.model.v1.catalog.script import FlipkartScraper
|
5 |
from shop2020.model.v1.catalog.script import FlipkartScraper
|
| 6 |
from shop2020.model.v1.catalog.impl.DataService import FlipkartItem, MarketplaceItems, Item, \
|
6 |
from shop2020.model.v1.catalog.impl.DataService import FlipkartItem, MarketplaceItems, Item, \
|
| 7 |
Category, SourcePercentageMaster, MarketPlaceHistory, MarketPlaceUpdateHistory, MarketPlaceItemPrice, \
|
7 |
Category, SourcePercentageMaster, MarketPlaceHistory, MarketPlaceUpdateHistory, MarketPlaceItemPrice, \
|
| 8 |
SourceCategoryPercentage, SourceItemPercentage, SourceReturnPercentage
|
8 |
SourceCategoryPercentage, SourceItemPercentage, SourceReturnPercentage
|
| 9 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
9 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
| 10 |
from shop2020.thriftpy.model.v1.catalog.ttypes import CompetitionCategory, CompetitionBasis, SalesPotential,\
|
10 |
from shop2020.thriftpy.model.v1.catalog.ttypes import CompetitionCategory, SalesPotential,\
|
| 11 |
Decision, RunType
|
11 |
Decision, RunType
|
| 12 |
from shop2020.clients.CatalogClient import CatalogClient
|
12 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 13 |
from shop2020.clients.InventoryClient import InventoryClient
|
13 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 14 |
import urllib2
|
14 |
import urllib2
|
| 15 |
import requests
|
15 |
import requests
|
| Line 224... |
Line 224... |
| 224 |
continue
|
224 |
continue
|
| 225 |
if getLastDaySale(autoIncrementItem.item_id)<=2:
|
225 |
if getLastDaySale(autoIncrementItem.item_id)<=2:
|
| 226 |
markReasonForMpItem(autoIncrementItem,'Last day sale is less than 3',Decision.AUTO_INCREMENT_FAILED)
|
226 |
markReasonForMpItem(autoIncrementItem,'Last day sale is less than 3',Decision.AUTO_INCREMENT_FAILED)
|
| 227 |
continue
|
227 |
continue
|
| 228 |
antecedentPrice = session.query(MarketPlaceHistory.ourSellingPrice).filter(MarketPlaceHistory.item_id==autoIncrementItem.item_id).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).filter(MarketPlaceHistory.timestamp>time-timedelta(days=1)).order_by(asc(MarketPlaceHistory.timestamp)).first()
|
228 |
antecedentPrice = session.query(MarketPlaceHistory.ourSellingPrice).filter(MarketPlaceHistory.item_id==autoIncrementItem.item_id).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).filter(MarketPlaceHistory.timestamp>time-timedelta(days=1)).order_by(asc(MarketPlaceHistory.timestamp)).first()
|
| - |
|
229 |
try:
|
| - |
|
230 |
if antecedentPrice[0] is not None:
|
| - |
|
231 |
if float(math.ceil(autoIncrementItem.ourSellingPrice+max(10,.01*autoIncrementItem.ourSellingPrice))-math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0])))/math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0]))>.02:
|
| - |
|
232 |
markReasonForMpItem(autoIncrementItem,'Maximum price increase in last 24 hours should be 2%',Decision.AUTO_INCREMENT_FAILED)
|
| - |
|
233 |
continue
|
| - |
|
234 |
except:
|
| 229 |
if antecedentPrice is not None:
|
235 |
if antecedentPrice is not None:
|
| 230 |
if float(math.ceil(autoIncrementItem.ourSellingPrice+max(10,.01*autoIncrementItem.ourSellingPrice))-math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0])))/math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0]))>.02:
|
236 |
if float(math.ceil(autoIncrementItem.ourSellingPrice+max(10,.01*autoIncrementItem.ourSellingPrice))-math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0])))/math.ceil(antecedentPrice[0]+max(10,.01*antecedentPrice[0]))>.02:
|
| 231 |
markReasonForMpItem(autoIncrementItem,'Maximum price increase in last 24 hours should be 2%',Decision.AUTO_INCREMENT_FAILED)
|
237 |
markReasonForMpItem(autoIncrementItem,'Maximum price increase in last 24 hours should be 2%',Decision.AUTO_INCREMENT_FAILED)
|
| 232 |
continue
|
238 |
continue
|
| 233 |
mpItem = MarketplaceItems.get_by(itemId=autoIncrementItem.item_id,source=OrderSource.FLIPKART)
|
239 |
mpItem = MarketplaceItems.get_by(itemId=autoIncrementItem.item_id,source=OrderSource.FLIPKART)
|
| 234 |
if mpItem.maximumSellingPrice is not None and mpItem.maximumSellingPrice > 0:
|
240 |
if mpItem.maximumSellingPrice is not None and mpItem.maximumSellingPrice > 0:
|
| 235 |
if autoIncrementItem.ourSellingPrice+max(10,.01*autoIncrementItem.ourSellingPrice) > mpItem.maximumSellingPrice:
|
241 |
if autoIncrementItem.ourSellingPrice+max(10,.01*autoIncrementItem.ourSellingPrice) > mpItem.maximumSellingPrice:
|
| 236 |
markReasonForMpItem(autoIncrementItem,'Price cannot exceed Maximum Selling Price',Decision.AUTO_INCREMENT_FAILED)
|
242 |
markReasonForMpItem(autoIncrementItem,'Price cannot exceed Maximum Selling Price',Decision.AUTO_INCREMENT_FAILED)
|
| 237 |
continue
|
243 |
continue
|