Skip to content

Commit

Permalink
Merge pull request #260 from the-bokya/test_maxxing
Browse files Browse the repository at this point in the history
test: fix broken tests
  • Loading branch information
deepeshgarg007 authored Feb 7, 2025
2 parents 6986dda + f86b048 commit d7b346d
Show file tree
Hide file tree
Showing 26 changed files with 601 additions and 958 deletions.
4 changes: 2 additions & 2 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ bench start &> bench_run_logs.txt &
CI=Yes bench build --app frappe &
bench --site test_site reinstall --yes

bench get-app lending "${GITHUB_WORKSPACE}"
bench get-app "${GITHUB_WORKSPACE}"
bench --site test_site install-app lending
bench setup requirements --dev
bench setup requirements --dev
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,3 @@ jobs:
run: cd ~/frappe-bench/ && bench --site test_site run-tests --app lending --coverage
env:
TYPE: server

- name: Upload coverage data
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
files: /home/runner/frappe-bench/sites/coverage.xml
verbose: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*.egg-info
*.swp
tags
node_modules
node_modules
dist
17 changes: 14 additions & 3 deletions lending/loan_management/doctype/loan/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
)


# nosemgrep
class Loan(AccountsController):
def validate(self):
self.set_status()
Expand Down Expand Up @@ -132,6 +133,7 @@ def on_cancel(self):
]
self.set_status()

# nosemgrep
def set_status(self):
if self.docstatus == 0:
self.status = "Draft"
Expand Down Expand Up @@ -362,13 +364,22 @@ def get_total_loan_amount(applicant_type, applicant, company):
],
)

interest_amount = flt(
total_interest_amount = flt(
frappe.db.get_value(
"Loan Interest Accrual",
{"applicant_type": applicant_type, "company": company, "applicant": applicant, "docstatus": 1},
"sum(interest_amount - paid_interest_amount)",
"sum(interest_amount)",
)
)
paid_interest = flt(
frappe.db.get_value(
"Loan Repayment",
{"applicant_type": applicant_type, "company": company, "applicant": applicant, "docstatus": 1},
"sum(total_interest_paid)",
)
)

interest_amount = total_interest_amount - paid_interest

for loan in loan_details:
if loan.status in ("Disbursed", "Loan Closure Requested", "Active"):
Expand Down Expand Up @@ -414,7 +425,7 @@ def request_loan_closure(loan, posting_date=None, auto_close=0):
amounts["pending_principal_amount"]
+ amounts["interest_amount"]
+ amounts["penalty_amount"]
+ amounts.get("excess_amount_paid", 0)
- amounts.get("excess_amount_paid", 0)
)

loan_product, loan_status = frappe.get_value("Loan", loan, ["loan_product", "status"])
Expand Down
Loading

0 comments on commit d7b346d

Please sign in to comment.