Subversion Repositories SmartDukaan

Rev

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

Rev 18794 Rev 18795
Line 9005... Line 9005...
9005
    us_query = UserSanction.query
9005
    us_query = UserSanction.query
9006
    if userId:
9006
    if userId:
9007
        us_query = us_query.filter(UserSanction.user_id == userId)
9007
        us_query = us_query.filter(UserSanction.user_id == userId)
9008
    if creditorId:
9008
    if creditorId:
9009
        us_query = us_query.filter(UserSanction.creditor_id == creditorId)
9009
        us_query = us_query.filter(UserSanction.creditor_id == creditorId)
9010
        
9010
    us_query = us_query.filter(UserSanction.active == True)   
9011
    allSanctions = us_query.all()
9011
    allSanctions = us_query.all()
9012
    returnMap = {}
9012
    returnMap = {}
9013
    for sanction in allSanctions:
9013
    for sanction in allSanctions:
9014
        ticket_size = -1
9014
        ticket_size = -1
9015
        if creditorTicketSizeMap.has_key(sanction.creditor_id):
9015
        if creditorTicketSizeMap.has_key(sanction.creditor_id):
Line 9039... Line 9039...
9039
            returnMap[sanction.creditor_id] = creditorMap
9039
            returnMap[sanction.creditor_id] = creditorMap
9040
                    
9040
                    
9041
    return returnMap
9041
    return returnMap
9042
 
9042
 
9043
def get_user_sanction_details_paginated(userId, creditorId, limit=0, offset=0):
9043
def get_user_sanction_details_paginated(userId, creditorId, limit=0, offset=0):
9044
    totalCount = session.query(func.count(UserSanction.id)).all()
9044
    totalCount = UserSanction.query.filter(UserSanction.active == True).count()
9045
    hasMore = False
9045
    hasMore = False
9046
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9046
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9047
        hasMore = True 
9047
        hasMore = True 
9048
    us_query = UserSanction.query
9048
    us_query = UserSanction.query
9049
    if userId:
9049
    if userId:
9050
        us_query = us_query.filter(UserSanction.user_id == userId)
9050
        us_query = us_query.filter(UserSanction.user_id == userId)
9051
    if creditorId:
9051
    if creditorId:
9052
        us_query = us_query.filter(UserSanction.creditor_id == creditorId)
9052
        us_query = us_query.filter(UserSanction.creditor_id == creditorId)
-
 
9053
    us_query = us_query.filter(UserSanction.active == True)
9053
    if limit>0:
9054
    if limit>0:
9054
        us_query = us_query.limit(limit)
9055
        us_query = us_query.limit(limit)
9055
    if offset>0 and limit >0:
9056
    if offset>0 and limit >0:
9056
        us_query = us_query.offset(offset)
9057
        us_query = us_query.offset(offset)
9057
        
9058
        
Line 9117... Line 9118...
9117
    if offset>0 and limit >0:
9118
    if offset>0 and limit >0:
9118
        credit_hs_query = credit_hs_query.offset(offset)
9119
        credit_hs_query = credit_hs_query.offset(offset)
9119
    return credit_hs_query.all()
9120
    return credit_hs_query.all()
9120
 
9121
 
9121
def get_credit_history_records_paginated(paymentId, userId, creditorId, creditTxnType, limit=0, offset=0):
9122
def get_credit_history_records_paginated(paymentId, userId, creditorId, creditTxnType, limit=0, offset=0):
9122
    totalCount = session.query(func.count(CreditHistory.id)).all()
9123
    totalCount = CreditHistory.query.count()
9123
    hasMore = False
9124
    hasMore = False
9124
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9125
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9125
        hasMore = True
9126
        hasMore = True
9126
    credit_hs_query = CreditHistory.query
9127
    credit_hs_query = CreditHistory.query
9127
    if paymentId and paymentId>0:
9128
    if paymentId and paymentId>0:
Line 9247... Line 9248...
9247
        loan_hs_query = loan_hs_query.offset(offset)
9248
        loan_hs_query = loan_hs_query.offset(offset)
9248
    
9249
    
9249
    return loan_hs_query.all()
9250
    return loan_hs_query.all()
9250
 
9251
 
9251
def get_loan_history_records_paginated(paymentId, userId, creditorId, creditTxnType, limit=0, offset=0):
9252
def get_loan_history_records_paginated(paymentId, userId, creditorId, creditTxnType, limit=0, offset=0):
9252
    totalCount = session.query(func.count(LoanHistory.id)).all()
9253
    totalCount = LoanHistory.query.count()
9253
    hasMore = False
9254
    hasMore = False
9254
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9255
    if limit >0 and offset > 0 and (limit+offset) < totalCount:
9255
        hasMore = True
9256
        hasMore = True
9256
    loan_hs_query = LoanHistory.query
9257
    loan_hs_query = LoanHistory.query
9257
    if paymentId and paymentId>0:
9258
    if paymentId and paymentId>0: