Subversion Repositories SmartDukaan

Rev

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

Rev 13999 Rev 14000
Line 165... Line 165...
165
    if window==None:
165
    if window==None:
166
        window = 50
166
        window = 50
167
    result = {}
167
    result = {}
168
    skip = (page-1)*window
168
    skip = (page-1)*window
169
    collection = get_mongo_connection().Dtr.merchantOrder
169
    collection = get_mongo_connection().Dtr.merchantOrder
170
    cursor = collection.find({"userId":userId}).sort([("$natural",-1)])
170
    cursor = collection.find({"userId":userId}).sort("$natural",-1)
171
    total_count = cursor.count()
171
    total_count = cursor.count()
172
    pages = total_count/window + (0 if total_count%window==0 else 1)  
172
    pages = total_count/window + (0 if total_count%window==0 else 1)  
173
    print "total_count", total_count
173
    print "total_count", total_count
174
    if total_count > skip:
174
    if total_count > skip:
175
        cursor = cursor.skip(skip).limit(window)
175
        cursor = cursor.skip(skip).limit(window)