Subversion Repositories SmartDukaan

Rev

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

Rev 14670 Rev 14671
Line 313... Line 313...
313
        result={}
313
        result={}
314
        result['amount'] = 0.0
314
        result['amount'] = 0.0
315
    result['nextCredit'] = datetime.strftime(next_weekday(datetime.now(), int(PythonPropertyReader.getConfig('CREDIT_DAY_OF_WEEK'))),"%Y-%m-%d %H:%M:%S")
315
    result['nextCredit'] = datetime.strftime(next_weekday(datetime.now(), int(PythonPropertyReader.getConfig('CREDIT_DAY_OF_WEEK'))),"%Y-%m-%d %H:%M:%S")
316
    return result
316
    return result
317
 
317
 
-
 
318
def getPendingCashbacks(userId):
-
 
319
    result = get_mongo_connection().Dtr.merchantOrder\
-
 
320
        .aggregate([
-
 
321
                    {'$match':{'subOrders.cashBackStatus':Store.CB_PENDING, 'userId':userId}},
-
 
322
                    {'$unwind':"$subOrders"},
-
 
323
                    {'$match':{'subOrders.cashBackStatus':Store.CB_PENDING}},
-
 
324
                    { 
-
 
325
                     '$group':{
-
 
326
                               '_id':None,
-
 
327
                               'amount': { '$sum':'$subOrders.cashBackAmount'},
-
 
328
                               }
-
 
329
                     }
-
 
330
                ])['result']
-
 
331
 
-
 
332
    if len(result)>0:
-
 
333
        result = result[0]        
-
 
334
        result.pop("_id")
-
 
335
    else:
-
 
336
        result={}
-
 
337
        result['amount'] = 0.0
-
 
338
    return result
-
 
339
 
318
def __populateCache(userId):
340
def __populateCache(userId):
319
    print "Populating memcache for userId",userId
341
    print "Populating memcache for userId",userId
320
    outer_query = []
342
    outer_query = []
321
    outer_query.append({"showDeal":1})
343
    outer_query.append({"showDeal":1})
322
    query = {}
344
    query = {}