Merge branch 'dev' into picture-feedback
This commit is contained in:
commit
34ad40778b
180 files changed
+13262
-5333
No files matched your search
@@ -4,6 +4,7 @@ backend/tests/test_contract_payment_ledger_focus.py
|
||||
用途:验收合同台账汇总卡按合同计数,以及点卡片过滤列表。
|
||||
依赖:Flask test client、ContractPaymentContract、ContractPaymentNode、ledger_focus。
|
||||
逻辑:固定业务日 2026-09-10,分别构造即将到期、逾期、进行中、本月应付合同后核对计数与 focus 筛选。
|
||||
金额和比例都为 0 的验收款不把合同算进逾期。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -12,7 +13,7 @@ from datetime import date
|
||||
|
||||
from app import db
|
||||
from app.models import Agent, ContractPaymentContract, ContractPaymentNode, User
|
||||
from app.services.contract_payment.ledger_focus import ledger_focus_counts
|
||||
from app.services.contract_payment.ledger_focus import classify_ledger_status, ledger_focus_counts
|
||||
|
||||
|
||||
def _create_user(*, username: str) -> User:
|
||||
@@ -136,3 +137,37 @@ def test_list_contracts_focus_filters_ledger(client, app, monkeypatch):
|
||||
assert summary.get_json()['data']['active'] == 2
|
||||
assert 'needs_completion' not in summary.get_json()['data']
|
||||
assert empty.get_json()['data']['total'] == 0
|
||||
|
||||
|
||||
def test_zero_amount_stage_does_not_mark_contract_overdue():
|
||||
"""金额和比例都为 0 的阶段不参与逾期。"""
|
||||
status = classify_ledger_status(
|
||||
contract_status='active',
|
||||
parse_status='parsed',
|
||||
nodes=[
|
||||
{
|
||||
'status': 'paid',
|
||||
'percentage': '50',
|
||||
'amount': '4250.00',
|
||||
'due_date': date(2026, 9, 2),
|
||||
'anchor_date': date(2026, 9, 2),
|
||||
},
|
||||
{
|
||||
'status': 'active',
|
||||
'percentage': '0',
|
||||
'amount': '0.00',
|
||||
'due_date': date(2026, 9, 24),
|
||||
'anchor_date': date(2026, 9, 24),
|
||||
},
|
||||
{
|
||||
'status': 'active',
|
||||
'percentage': '0',
|
||||
'amount': '0.00',
|
||||
'due_date': date(2027, 3, 23),
|
||||
'anchor_date': date(2026, 9, 24),
|
||||
},
|
||||
],
|
||||
today=date(2026, 10, 27),
|
||||
)
|
||||
# 关键断言:预付款已付,验收款和质保款为 0,合同应为已完成而不是已逾期。
|
||||
assert status == 'completed'
|
||||
Reference in new issue
Block a user