Subversion Repositories SmartDukaan

Rev

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

Rev 13989 Rev 13991
Line 199... Line 199...
199
    cursor = collection.find({"userId":userId})
199
    cursor = collection.find({"userId":userId})
200
    total_count = cursor.count()
200
    total_count = cursor.count()
201
    pages = total_count/window + (0 if total_count%window==0 else 1)  
201
    pages = total_count/window + (0 if total_count%window==0 else 1)  
202
    print "total_count", total_count
202
    print "total_count", total_count
203
    if total_count > skip:
203
    if total_count > skip:
204
        cursor = cursor.skip(skip).limit(window).sort({'batchId':-1})
204
        cursor = cursor.skip(skip).limit(window).sort([('batchId',-1)])
205
        refunds = []
205
        refunds = []
206
        for refund in cursor:
206
        for refund in cursor:
207
            del(refund["_id"])
207
            del(refund["_id"])
208
            refunds.append(refund)
208
            refunds.append(refund)
209
        result['data'] = refunds
209
        result['data'] = refunds
Line 215... Line 215...
215
        return result
215
        return result
216
    else:
216
    else:
217
        return result
217
        return result
218
    
218
    
219
def getPendingRefunds(userId):
219
def getPendingRefunds(userId):
-
 
220
    print type(userId)
220
    result = get_mongo_connection().Dtr.merchantOrder\
221
    result = get_mongo_connection().Dtr.merchantOrder\
221
        .aggregate([
222
        .aggregate([
222
                    {'$match':{'subOrders.cashBackStatus':Store.CB_APPROVED, 'userId':userId}},
223
                    {'$match':{'subOrders.cashBackStatus':Store.CB_APPROVED, 'userId':userId}},
223
                    {'$unwind':"$subOrders"},
224
                    {'$unwind':"$subOrders"},
224
                    { 
225
                    {