Subversion Repositories SmartDukaan

Rev

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

Rev 17714 Rev 17727
Line 1763... Line 1763...
1763
                item[0]['dp'] = d['dp']
1763
                item[0]['dp'] = d['dp']
1764
                item[0]['showDp'] = d['showDp']
1764
                item[0]['showDp'] = d['showDp']
1765
            except:
1765
            except:
1766
                item[0]['dp'] = 0.0
1766
                item[0]['dp'] = 0.0
1767
                item[0]['showDp'] = 0
1767
                item[0]['showDp'] = 0
-
 
1768
                
-
 
1769
            try:
-
 
1770
                if item[0]['showVideo']==0:
-
 
1771
                    item[0]['videoLink'] =""
-
 
1772
            except:
-
 
1773
                item[0]['videoLink'] =""
-
 
1774
            try:
-
 
1775
                if item[0]['quantity'] >1:
-
 
1776
                    ppq = float(item[0]['available_price'])/item[0]['quantity']
-
 
1777
                    
-
 
1778
                    if ppq == round(ppq):
-
 
1779
                        item[0]['ppq'] = int(ppq)
-
 
1780
                    else:
-
 
1781
                        item[0]['ppq'] = round(ppq,2)
-
 
1782
                    item[0]['tagline'] = ""
-
 
1783
                else:
-
 
1784
                    item[0]['ppq'] = 0
-
 
1785
            except:
-
 
1786
                item[0]['ppq'] = 0
-
 
1787
            
-
 
1788
            if item[0]['category_id']!=6:
-
 
1789
                try:
-
 
1790
                    item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?filter=brand&brands='+str(int(item[0]['brand_id']))
-
 
1791
                    item[0]['filterText'] = 'More %s items'%(item[0]['brand'])
-
 
1792
                except:
-
 
1793
                    item[0]['filterLink'] = ""
-
 
1794
                    item[0]['filterText'] = ""
-
 
1795
            else:
-
 
1796
                try:
-
 
1797
                    if item[0]['subCategory']=='' or item[0]['subCategory'] is None or item[0]['subCategor']:
-
 
1798
                        raise
-
 
1799
                    item[0]['filterLink'] = '/category/'+str(int(item[0]['category_id']))+'?filter=subcategory&subcategories='+str(int(item[0]['subCategoryId']))
-
 
1800
                    item[0]['filterText'] = 'More %s'%(item[0]['subCategory'])
-
 
1801
                except:
-
 
1802
                    item[0]['filterLink'] = ''
-
 
1803
                    item[0]['filterText'] = ""
-
 
1804
        
1768
            temp.append(item[0])
1805
            temp.append(item[0])
1769
        if len(temp) > 1:
1806
        if len(temp) > 1:
1770
            temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
1807
            temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
1771
        dealsListMap.append(temp)
1808
        dealsListMap.append(temp)
1772
    return dealsListMap
1809
    return dealsListMap
Line 2282... Line 2319...
2282
        
2319
        
2283
        mc.set("subCategoryFilter",{3:mobData, 5:tabData, 6:accData}, 600)  
2320
        mc.set("subCategoryFilter",{3:mobData, 5:tabData, 6:accData}, 600)  
2284
    
2321
    
2285
    return sorted(mc.get("subCategoryFilter").get(category_id), key = lambda x: (-x['count'], x['subCategory']))
2322
    return sorted(mc.get("subCategoryFilter").get(category_id), key = lambda x: (-x['count'], x['subCategory']))
2286
 
2323
 
-
 
2324
def dummyLogin(data):
-
 
2325
    exist = list(get_mongo_connection().Catalog.DummyUser.find({'email':data['email']}))
-
 
2326
    if len(exist) > 0:
-
 
2327
        return {'user_id':exist[0]['_id']}
-
 
2328
    else:
-
 
2329
        return {'user_id':0}
-
 
2330
 
-
 
2331
def dummyRegister(data):
-
 
2332
    try:
-
 
2333
        exist = list(get_mongo_connection().Catalog.DummyUser.find({'email':data['email']}))
-
 
2334
        if len(exist) > 0:
-
 
2335
            return {'msg':"Email already registered",'user_id':0}
-
 
2336
        else:
-
 
2337
            max_id = list(get_mongo_connection().Catalog.DummyUser.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
-
 
2338
            if len(max_id) ==0:
-
 
2339
                max_id = 0
-
 
2340
            else:
-
 
2341
                max_id = max_id[0]['_id']
-
 
2342
            data['_id'] = max_id +1
-
 
2343
            get_mongo_connection().Catalog.DummyUser.insert(data)
-
 
2344
            return {'msg':"Registration successful",'user_id':data['_id']}
-
 
2345
    except:
-
 
2346
        return {'msg':"Error in registration.",'user_id':0}
2287
 
2347
 
2288
def main():
2348
def main():
2289
    featuredDeals = mc.get("featured_deals")
2349
    featuredDeals = mc.get("featured_deals")
2290
    print resetCache("47")
2350
    print resetCache("47")
2291
    print datetime.now()
2351
    print datetime.now()