Subversion Repositories SmartDukaan

Rev

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

Rev 12473 Rev 12475
Line 449... Line 449...
449
        thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType = (0,)*9
449
        thirdLowestSellerRating, lowestSellerType, secondLowestSellerType, thirdLowestSellerType = (0,)*9
450
        isPromo = False
450
        isPromo = False
451
        sku = val.sku
451
        sku = val.sku
452
        multipleListings = False
452
        multipleListings = False
453
        ourSkuDetails = ourPricingForSku.get(val.sku)
453
        ourSkuDetails = ourPricingForSku.get(val.sku)
454
        if not (ourSkuDetails.get('promotion') and (amazonLongTermActivePromotions.has_key(val.sku) or amazonShortTermActivePromotions.has_key(val.sku))):
454
        if (ourSkuDetails.get('promotion')!=(amazonLongTermActivePromotions.has_key(val.sku) or amazonShortTermActivePromotions.has_key(val.sku))):
455
            temp = []
455
            temp = []
456
            temp.append(val)
456
            temp.append(val)
457
            print "promo misconfigured"
457
            print "promo misconfigured"
458
            temp.append("Promo misconfigured")
458
            temp.append("Promo misconfigured")
459
            exceptionList.append(temp)
459
            exceptionList.append(temp)
460
            continue
460
            continue
461
            
461
        
462
        scrapInfo.append(ourSkuDetails)
462
        scrapInfo.append(ourSkuDetails)
463
        sortedScrapInfo =  sorted(scrapInfo, key=itemgetter('promoPrice','notOurSku'))
463
        sortedScrapInfo =  sorted(scrapInfo, key=itemgetter('promoPrice','notOurSku'))
464
        for info in sortedScrapInfo:
464
        for info in sortedScrapInfo:
465
            if  not info['notOurSku']:
465
            if  not info['notOurSku']:
466
                ourSp = info['sellingPrice']
466
                ourSp = info['sellingPrice']
Line 1538... Line 1538...
1538
    sheet.write(0, 28, "Margin", heading_xf)
1538
    sheet.write(0, 28, "Margin", heading_xf)
1539
    sheet.write(0, 29, "Avg Sale", heading_xf)
1539
    sheet.write(0, 29, "Avg Sale", heading_xf)
1540
    sheet.write(0, 30, "Sales History", heading_xf)
1540
    sheet.write(0, 30, "Sales History", heading_xf)
1541
    
1541
    
1542
    sheet_iterator = 1
1542
    sheet_iterator = 1
1543
    amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE).all()
1543
    amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.NEGATIVE_MARGIN).all()
1544
    for amongCheapestItem in amongCheapestItems:
1544
    for amongCheapestItem in amongCheapestItems:
1545
        amScraping =  amongCheapestItem[0]
1545
        amScraping =  amongCheapestItem[0]
1546
        item = amongCheapestItem[1]
1546
        item = amongCheapestItem[1]
1547
        sheet.write(sheet_iterator, 0, amScraping.item_id)
1547
        sheet.write(sheet_iterator, 0, amScraping.item_id)
1548
        if amScraping.warehouseLocation == 1:
1548
        if amScraping.warehouseLocation == 1:
Line 1604... Line 1604...
1604
    sheet.write(0, 4, "Brand", heading_xf)
1604
    sheet.write(0, 4, "Brand", heading_xf)
1605
    sheet.write(0, 5, "Product Name", heading_xf)
1605
    sheet.write(0, 5, "Product Name", heading_xf)
1606
    sheet.write(0, 6, "Reason", heading_xf)
1606
    sheet.write(0, 6, "Reason", heading_xf)
1607
    
1607
    
1608
    sheet_iterator = 1
1608
    sheet_iterator = 1
1609
    amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.AMONG_CHEAPEST_CAN_COMPETE).all()
1609
    amongCheapestItems = session.query(AmazonScrapingHistory,Item).join((Item,AmazonScrapingHistory.item_id==Item.id)).filter(AmazonScrapingHistory.competitiveCategory==CompetitionCategory.EXCEPTION).all()
1610
    for amongCheapestItem in amongCheapestItems:
1610
    for amongCheapestItem in amongCheapestItems:
1611
        amScraping =  amongCheapestItem[0]
1611
        amScraping =  amongCheapestItem[0]
1612
        item = amongCheapestItem[1]
1612
        item = amongCheapestItem[1]
1613
        sheet.write(sheet_iterator, 0, amScraping.item_id)
1613
        sheet.write(sheet_iterator, 0, amScraping.item_id)
1614
        if amScraping.warehouseLocation == 1:
1614
        if amScraping.warehouseLocation == 1: