diff --git a/app/api/services/offer_analysis.py b/app/api/services/offer_analysis.py index 0162088..ad417f1 100644 --- a/app/api/services/offer_analysis.py +++ b/app/api/services/offer_analysis.py @@ -40,23 +40,23 @@ class OfferAnalysis: # we can now find the origin transactions # Find the last loan - it will have original_transaction - last_customer_loan = Loan.get_customer_last_loan(customer.id) - logger.info(f"{last_customer_loan}") + # last_customer_loan = Loan.get_customer_last_loan(customer.id) + # logger.info(f"{last_customer_loan}") new_eligible_amount = 0 - if last_customer_loan: - original_transaction = last_customer_loan.original_transaction or last_customer_loan.transaction_id + # if last_customer_loan: + # original_transaction = last_customer_loan.original_transaction or last_customer_loan.transaction_id - real_eligible_amount = last_customer_loan.eligible_amount + # real_eligible_amount = last_customer_loan.eligible_amount - active_loans = Loan.get_active_loans_by_original_transaction(original_transaction) + # active_loans = Loan.get_active_loans_by_original_transaction(original_transaction) - sum_active_loans = sum(loan.current_loan_amount for loan in active_loans) + # sum_active_loans = sum(loan.current_loan_amount for loan in active_loans) - new_eligible_amount = max(real_eligible_amount - sum_active_loans, 0) + # new_eligible_amount = max(real_eligible_amount - sum_active_loans, 0) - logger.info(f"Real eligible: {real_eligible_amount}, Sum of active: {sum_active_loans}, New eligible: {new_eligible_amount}") + # logger.info(f"Real eligible: {real_eligible_amount}, Sum of active: {sum_active_loans}, New eligible: {new_eligible_amount}") # Construct eligible_offers