| Line 1836... |
Line 1836... |
| 1836 |
elif (float(lowestOfferPrice - ourNlc))/lowestOfferPrice >=0 and (float(lowestOfferPrice - ourNlc))/lowestOfferPrice <=.02:
|
1836 |
elif (float(lowestOfferPrice - ourNlc))/lowestOfferPrice >=0 and (float(lowestOfferPrice - ourNlc))/lowestOfferPrice <=.02:
|
| 1837 |
return 'MEDIUM'
|
1837 |
return 'MEDIUM'
|
| 1838 |
else:
|
1838 |
else:
|
| 1839 |
return 'LOW'
|
1839 |
return 'LOW'
|
| 1840 |
|
1840 |
|
| - |
|
1841 |
def groupData(previousTimestamp,timestampNow):
|
| - |
|
1842 |
previousData = session.query(MarketPlaceHistory).filter(MarketPlaceHistory.timestamp==previousTimestamp).filter(MarketPlaceHistory.source==OrderSource.SNAPDEAL).all()
|
| - |
|
1843 |
for data in previousData:
|
| - |
|
1844 |
latestItemData = session.query(MarketPlaceHistory).filter(MarketPlaceHistory.timestamp==timestampNow).filter(MarketPlaceHistory.item_id==data.item_id).first()
|
| - |
|
1845 |
if latestItemData is None:
|
| - |
|
1846 |
continue
|
| - |
|
1847 |
if data.ourSellingPrice == latestItemData.ourSellingPrice and data.ourOfferPrice == latestItemData.ourOfferPrice and data.competitiveCategory == latestItemData.competitiveCategory:
|
| - |
|
1848 |
if data.toGroup is None:
|
| - |
|
1849 |
data.toGroup=False
|
| - |
|
1850 |
latestItemData.toGroup=True
|
| - |
|
1851 |
else:
|
| - |
|
1852 |
latestItemData.toGroup=True
|
| - |
|
1853 |
data.toGroup=False
|
| - |
|
1854 |
else:
|
| - |
|
1855 |
latestItemData=None
|
| - |
|
1856 |
session.commit()
|
| - |
|
1857 |
|
| 1841 |
def main():
|
1858 |
def main():
|
| 1842 |
parser = optparse.OptionParser()
|
1859 |
parser = optparse.OptionParser()
|
| 1843 |
parser.add_option("-t", "--type", dest="runType",
|
1860 |
parser.add_option("-t", "--type", dest="runType",
|
| 1844 |
default="FULL", type="string",
|
1861 |
default="FULL", type="string",
|
| 1845 |
help="Run type FULL or FAVOURITE")
|
1862 |
help="Run type FULL or FAVOURITE")
|
| Line 1856... |
Line 1873... |
| 1856 |
cantComepeteItems = commitCantCompete(cantCompete,timestamp)
|
1873 |
cantComepeteItems = commitCantCompete(cantCompete,timestamp)
|
| 1857 |
buyBoxList = commitBuyBox(buyBoxItems,timestamp)
|
1874 |
buyBoxList = commitBuyBox(buyBoxItems,timestamp)
|
| 1858 |
competitiveItems = commitCompetitive(competitive,timestamp)
|
1875 |
competitiveItems = commitCompetitive(competitive,timestamp)
|
| 1859 |
competitiveNoInventoryItems = commitCompetitiveNoInventory(competitiveNoInventory,timestamp)
|
1876 |
competitiveNoInventoryItems = commitCompetitiveNoInventory(competitiveNoInventory,timestamp)
|
| 1860 |
negativeMarginItems = commitNegativeMargin(negativeMargin,timestamp)
|
1877 |
negativeMarginItems = commitNegativeMargin(negativeMargin,timestamp)
|
| - |
|
1878 |
groupData(previousProcessingTimestamp,timestamp)
|
| 1861 |
successfulAutoDecrease = fetchItemsForAutoDecrease(timestamp)
|
1879 |
successfulAutoDecrease = fetchItemsForAutoDecrease(timestamp)
|
| 1862 |
successfulAutoIncrease = fetchItemsForAutoIncrease(timestamp)
|
1880 |
successfulAutoIncrease = fetchItemsForAutoIncrease(timestamp)
|
| 1863 |
if options.runType=='FULL':
|
1881 |
if options.runType=='FULL':
|
| 1864 |
previousAutoFav, nowAutoFav = markAutoFavourite()
|
1882 |
previousAutoFav, nowAutoFav = markAutoFavourite()
|
| 1865 |
if options.runType=='FULL':
|
1883 |
if options.runType=='FULL':
|
| Line 1870... |
Line 1888... |
| 1870 |
sendAutoPricingMail(successfulAutoDecrease,successfulAutoIncrease)
|
1888 |
sendAutoPricingMail(successfulAutoDecrease,successfulAutoIncrease)
|
| 1871 |
processLostBuyBoxItems(previousProcessingTimestamp[0],timestamp)
|
1889 |
processLostBuyBoxItems(previousProcessingTimestamp[0],timestamp)
|
| 1872 |
updatePricesOnSnapdeal(successfulAutoDecrease,successfulAutoIncrease)
|
1890 |
updatePricesOnSnapdeal(successfulAutoDecrease,successfulAutoIncrease)
|
| 1873 |
|
1891 |
|
| 1874 |
if __name__ == '__main__':
|
1892 |
if __name__ == '__main__':
|
| 1875 |
main()
|
- |
|
| 1876 |
|
1893 |
main()
|
| - |
|
1894 |
|
| 1877 |
|
1895 |
|