Subversion Repositories SmartDukaan

Rev

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

Rev 12716 Rev 12717
Line 35... Line 35...
35
syncPrice=config_client.get_property('sync_price_on_marketplace')
35
syncPrice=config_client.get_property('sync_price_on_marketplace')
36
 
36
 
37
amazonAsinPrice={}
37
amazonAsinPrice={}
38
amazonLongTermActivePromotions = {}
38
amazonLongTermActivePromotions = {}
39
amazonShortTermActivePromotions = {}
39
amazonShortTermActivePromotions = {}
-
 
40
wpiTodayExpiry = {}
40
notListed = []
41
notListed = []
41
saleMap = {}
42
saleMap = {}
42
categoryMap = {}
43
categoryMap = {}
43
DataService.initialize(db_hostname=host)
44
DataService.initialize(db_hostname=host)
44
 
45
 
Line 130... Line 131...
130
        else:
131
        else:
131
            sku = 'FBB'+str(autoDecrementItem.item_id)
132
            sku = 'FBB'+str(autoDecrementItem.item_id)
132
        if amazonShortTermActivePromotions.has_key(sku):
133
        if amazonShortTermActivePromotions.has_key(sku):
133
            markReasonForItem(autoDecrementItem,'Item in short term promotion',Decision.AUTO_DECREMENT_FAILED)
134
            markReasonForItem(autoDecrementItem,'Item in short term promotion',Decision.AUTO_DECREMENT_FAILED)
134
            continue
135
            continue
-
 
136
        if wpiTodayExpiry.has_key(sku) and not amazonLongTermActivePromotions.has_key(sku):
-
 
137
            markReasonForItem(autoDecrementItem,'Last Promotion ended in 24 hours and no current active promotion',Decision.AUTO_DECREMENT_FAILED)
-
 
138
            continue
135
        if math.ceil(autoDecrementItem.proposedSp) >= autoDecrementItem.promoPrice:
139
        if math.ceil(autoDecrementItem.proposedSp) >= autoDecrementItem.promoPrice:
136
            markReasonForItem(autoDecrementItem,'Proposed SP greater than or equal to current SP',Decision.AUTO_DECREMENT_FAILED)
140
            markReasonForItem(autoDecrementItem,'Proposed SP greater than or equal to current SP',Decision.AUTO_DECREMENT_FAILED)
137
            continue
141
            continue
138
        if autoDecrementItem.proposedSp < autoDecrementItem.lowestPossibleSp:
142
        if autoDecrementItem.proposedSp < autoDecrementItem.lowestPossibleSp:
139
            markReasonForItem(autoDecrementItem,'Proposed SP less than lowest possible SP',Decision.AUTO_DECREMENT_FAILED)
143
            markReasonForItem(autoDecrementItem,'Proposed SP less than lowest possible SP',Decision.AUTO_DECREMENT_FAILED)
Line 189... Line 193...
189
        else:
193
        else:
190
            sku = 'FBB'+str(autoIncrementItem.item_id)
194
            sku = 'FBB'+str(autoIncrementItem.item_id)
191
        if amazonShortTermActivePromotions.has_key(sku):
195
        if amazonShortTermActivePromotions.has_key(sku):
192
            markReasonForItem(autoIncrementItem,'Item in short term promotion',Decision.AUTO_INCREMENT_FAILED)
196
            markReasonForItem(autoIncrementItem,'Item in short term promotion',Decision.AUTO_INCREMENT_FAILED)
193
            continue
197
            continue
-
 
198
        if wpiTodayExpiry.has_key(sku) and not amazonLongTermActivePromotions.has_key(sku):
-
 
199
            markReasonForItem(autoIncrementItem,'Last Promotion ended in 24 hours and no current active promotion',Decision.AUTO_INCREMENT_FAILED)
-
 
200
            continue
194
        if autoIncrementItem.totalSeller==1 and autoIncrementItem.ourRank==1:
201
        if autoIncrementItem.totalSeller==1 and autoIncrementItem.ourRank==1:
195
            markReasonForItem(autoIncrementItem,'We are the only seller',Decision.AUTO_INCREMENT_FAILED)
202
            markReasonForItem(autoIncrementItem,'We are the only seller',Decision.AUTO_INCREMENT_FAILED)
196
            continue 
203
            continue 
197
        if autoIncrementItem.proposedSp <= autoIncrementItem.promoPrice:
204
        if autoIncrementItem.proposedSp <= autoIncrementItem.promoPrice:
198
            markReasonForItem(autoIncrementItem,'Proposed SP less than current SP',Decision.AUTO_INCREMENT_FAILED)
205
            markReasonForItem(autoIncrementItem,'Proposed SP less than current SP',Decision.AUTO_INCREMENT_FAILED)
Line 466... Line 473...
466
    .order_by(desc(AmazonPromotion.addedOn)).all()
473
    .order_by(desc(AmazonPromotion.addedOn)).all()
467
    for amPromotion in amPromotions:
474
    for amPromotion in amPromotions:
468
        if amazonShortTermActivePromotions.has_key(amPromotion.sku):
475
        if amazonShortTermActivePromotions.has_key(amPromotion.sku):
469
            continue
476
            continue
470
        amazonShortTermActivePromotions[amPromotion.sku] = __Promotion(amPromotion.salePrice,amPromotion.subsidy,amPromotion.promotionType,amPromotion.endDate)
477
        amazonShortTermActivePromotions[amPromotion.sku] = __Promotion(amPromotion.salePrice,amPromotion.subsidy,amPromotion.promotionType,amPromotion.endDate)
-
 
478
    amPromotions = AmazonPromotion.query.filter(AmazonPromotion.endDate>=(time-timedelta(days=1))).filter(AmazonPromotion.endDate<=time).filter(AmazonPromotion.promotionType==AmazonPromotionType.SHORTTERM).filter(AmazonPromotion.promotionActive==True) \
-
 
479
    .order_by(desc(AmazonPromotion.addedOn)).all()
-
 
480
    if wpiTodayExpiry.has_key(amPromotion.sku):
-
 
481
        continue
-
 
482
        wpiTodayExpiry[amPromotion.sku] = __Promotion(amPromotion.salePrice,amPromotion.subsidy,amPromotion.promotionType,amPromotion.endDate)
471
    session.close()
483
    session.close()
472
    print "No of items populated ",len(itemInfo)
484
    print "No of items populated ",len(itemInfo)
473
    sleep(5)
485
    sleep(5)
474
    return itemInfo
486
    return itemInfo
475
 
487