[fix]: Offer schedules

This commit is contained in:
VivianDee
2025-04-30 12:11:32 +01:00
parent 9dae2d951c
commit 2addf25a67
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ class ProvideLoanService(BaseService):
upfront_fee = charges["upfront_payment"]
repayment_amount = charges["repayment_amount"]
#installment_amount = charges["installment_amount"]
tenor = offer.tenor // 30 # Convert to months
schedule = offer.schedule
upfront_payment = charges["upfront_payment"]
total_amount = charges["total_amount"]
@@ -107,7 +107,7 @@ class ProvideLoanService(BaseService):
db.session.flush()
schedule = LoanRepaymentSchedule.add_repayment_schedule(loan = loan, tenor = tenor, transaction_id = transaction_id)
schedule = LoanRepaymentSchedule.add_repayment_schedule(loan = loan, num_schedules = num_schedules, transaction_id = transaction_id)
if not schedule:
+2 -2
View File
@@ -29,14 +29,14 @@ class LoanRepaymentSchedule(db.Model):
@classmethod
def add_repayment_schedule(cls, loan, tenor, transaction_id):
def add_repayment_schedule(cls, loan, num_schedules, transaction_id):
"""
Add repayment schedules for a given loan.
"""
now = datetime.now(timezone.utc)
schedules = []
for i in range(tenor):
for i in range(num_schedules):
due_date = now + relativedelta(months=i + 1)
schedule = LoanRepaymentSchedule(
loan_id=loan.id,