Subversion Repositories SmartDukaan

Rev

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

Rev 13168 Rev 13183
Line 1658... Line 1658...
1658
    if insurerId ==1:
1658
    if insurerId ==1:
1659
        #itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerId == insurerId).first()
1659
        #itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerId == insurerId).first()
1660
        #if itemInsurerMapping:
1660
        #if itemInsurerMapping:
1661
            #Default insurance premium is 1.5%
1661
            #Default insurance premium is 1.5%
1662
        #    return round(price * (1.5/100) * quantity)
1662
        #    return round(price * (1.5/100) * quantity)
1663
        return round(price * (1.5/100))* quantity
1663
        return round(price * (1.5/100) * quantity)
1664
        '''insuranceAmount = 0.0
1664
        '''insuranceAmount = 0.0
1665
        if itemInsurerMapping.premiumType == PremiumType._NAMES_TO_VALUES.get("PERCENT"):
1665
        if itemInsurerMapping.premiumType == PremiumType._NAMES_TO_VALUES.get("PERCENT"):
1666
            insuranceAmount = price * (itemInsurerMapping.premiumAmount/100) * quantity
1666
            insuranceAmount = price * (itemInsurerMapping.premiumAmount/100) * quantity
1667
        else :
1667
        else :
1668
            insuranceAmount = itemInsurerMapping.premiumAmount * quantity
1668
            insuranceAmount = itemInsurerMapping.premiumAmount * quantity
Line 2779... Line 2779...
2779
            all_active_items_query = all_active_items_query.filter(PrivateDeals.item_id.in_(itemIds))
2779
            all_active_items_query = all_active_items_query.filter(PrivateDeals.item_id.in_(itemIds))
2780
        
2780
        
2781
        all_active_private_deals = all_active_items_query.all()
2781
        all_active_private_deals = all_active_items_query.all()
2782
        if all_active_private_deals is not None or all_active_private_deals!=[]:
2782
        if all_active_private_deals is not None or all_active_private_deals!=[]:
2783
            for active_private_deal in all_active_private_deals:
2783
            for active_private_deal in all_active_private_deals:
-
 
2784
                item = get_item(active_private_deal.item_id)
-
 
2785
                if item.sellingPrice >  active_private_deal.dealPrice:
2784
                dealsMap[active_private_deal.item_id] = to_t_private_deal(active_private_deal)
2786
                    dealsMap[active_private_deal.item_id] = to_t_private_deal(active_private_deal)
2785
        return dealsMap 
2787
        return dealsMap
2786
 
2788
 
2787
def add_or_update_private_deal(privatedeal):
2789
def add_or_update_private_deal(privatedeal):
2788
    print 'Inside update private deals'
2790
    print 'Inside update private deals'
2789
    try:
2791
    try:
2790
        deal =  PrivateDeals.get_by(item_id=privatedeal.item_id)
2792
        deal =  PrivateDeals.get_by(item_id=privatedeal.item_id)