Subversion Repositories SmartDukaan

Rev

Rev 12646 | Rev 12649 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12646 Rev 12647
Line 2195... Line 2195...
2195
            <th>Product Name</th>
2195
            <th>Product Name</th>
2196
            <th>Selling Price</th>
2196
            <th>Selling Price</th>
2197
            <th>Promo Price</th>
2197
            <th>Promo Price</th>
2198
            <th>Subsidy</th>
2198
            <th>Subsidy</th>
2199
            <th>Lowest Possible SP</th>
2199
            <th>Lowest Possible SP</th>
2200
            <th>WANLC <th>
2200
            <th>WANLC</th>
2201
            <th>Margin</th>
2201
            <th>Margin</th>
2202
            <th>Commission %</th>
2202
            <th>Commission %</th>
2203
            <th>Return Provision %</th>
2203
            <th>Return Provision %</th>
2204
            <th>Inventory</th>
2204
            <th>Inventory</th>
2205
            <th>Sales History</th>
2205
            <th>Sales History</th>
Line 2264... Line 2264...
2264
        except:
2264
        except:
2265
            print "Error: unable to send email."
2265
            print "Error: unable to send email."
2266
            
2266
            
2267
def sendAlertForCantCompete(timestamp):
2267
def sendAlertForCantCompete(timestamp):
2268
    cantCompeteItemsList = session.query(AmazonScrapingHistory).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.CANT_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
2268
    cantCompeteItemsList = session.query(AmazonScrapingHistory).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.CANT_COMPETE).filter(AmazonScrapingHistory.timestamp==timestamp).all()
-
 
2269
    print "type of cantCompeteItemList ",type(cantCompeteItemsList)
-
 
2270
    print "after conversion ",type(list(cantCompeteItemsList))
2269
    if cantCompeteItemsList is None or len(cantCompeteItemsList)==0:
2271
    if cantCompeteItemsList is None or len(cantCompeteItemsList)==0:
2270
        return
2272
        return
2271
    xstr = lambda s: s or ""
2273
    xstr = lambda s: s or ""
2272
    message="""<html>
2274
    message="""<html>
2273
            <body>
2275
            <body>
Line 2289... Line 2291...
2289
            <th>Proposed SP<th>
2291
            <th>Proposed SP<th>
2290
            <th>Inventory</th>
2292
            <th>Inventory</th>
2291
            <th>Sales History</th>
2293
            <th>Sales History</th>
2292
            </tr></thead>
2294
            </tr></thead>
2293
            <tbody>"""
2295
            <tbody>"""
2294
    cantCompeteItems =  sorted(cantCompeteItemsList, key=itemgetter('ourInventory'))
2296
    cantCompeteItems =  sorted(list(cantCompeteItemsList), key=itemgetter('ourInventory'))
2295
    for cantCompeteItem in cantCompeteItems:
2297
    for cantCompeteItem in cantCompeteItems:
2296
        amScraping = cantCompeteItem
2298
        amScraping = cantCompeteItem
2297
        item = Item.query.filter_by(id=amScraping.item_id).one()
2299
        item = Item.query.filter_by(id=amScraping.item_id).one()
2298
        if amScraping.warehouseLocation==1:
2300
        if amScraping.warehouseLocation==1:
2299
            sku='FBA'+str(amScraping.item_id)
2301
            sku='FBA'+str(amScraping.item_id)