Subversion Repositories SmartDukaan

Rev

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

Rev 11757 Rev 11758
Line 2253... Line 2253...
2253
        except:
2253
        except:
2254
            print "Error: unable to send email."
2254
            print "Error: unable to send email."
2255
 
2255
 
2256
def cheapButNotPrefAlert(timestamp):
2256
def cheapButNotPrefAlert(timestamp):
2257
    cheap_but_not_pref = session.query(MarketPlaceHistory,Item).join((Item,MarketPlaceHistory.item_id==Item.id)).filter(MarketPlaceHistory.timestamp==timestamp).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).filter(MarketPlaceHistory.competitiveCategory==CompetitionCategory.CHEAP_BUT_NOT_PREF).all()
2257
    cheap_but_not_pref = session.query(MarketPlaceHistory,Item).join((Item,MarketPlaceHistory.item_id==Item.id)).filter(MarketPlaceHistory.timestamp==timestamp).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).filter(MarketPlaceHistory.competitiveCategory==CompetitionCategory.CHEAP_BUT_NOT_PREF).all()
2258
    if cheap_but_not_pref is None:
2258
    if len(cheap_but_not_pref)==0:
2259
        return
2259
        return
2260
    xstr = lambda s: s or ""
2260
    xstr = lambda s: s or ""
2261
    message="""<html>
2261
    message="""<html>
2262
            <body>
2262
            <body>
2263
            <h3>Cheap But Not Preferred</h3>
2263
            <h3>Cheap But Not Preferred</h3>
Line 2371... Line 2371...
2371
    mpItems[:] = []
2371
    mpItems[:] = []
2372
    mismatches = []
2372
    mismatches = []
2373
    for k,v in flipkartPricing.iteritems():
2373
    for k,v in flipkartPricing.iteritems():
2374
        flipkartSellingPrice = v[0]
2374
        flipkartSellingPrice = v[0]
2375
        ourSellingPrice = saholicPricing.get(k)
2375
        ourSellingPrice = saholicPricing.get(k)
2376
        if not((ourSellingPrice - flipkartSellingPrice >= -3) and (flipkartSellingPrice - ourSellingPrice <=3)) and flipkartSellingPrice is not None:
2376
        if flipkartSellingPrice is not None and not((ourSellingPrice - flipkartSellingPrice >= -3) and (flipkartSellingPrice - ourSellingPrice <=3)):
2377
            mismatches.append(k)
2377
            mismatches.append(k)
2378
    print "mismatches are ",mismatches
2378
    print "mismatches are ",mismatches
2379
    if len(mismatches)==0:
2379
    if len(mismatches)==0:
2380
        return
2380
        return
2381
    for item in mismatches:
2381
    for item in mismatches: