chore(release): bump version to 2.3.30
This commit is contained in:
parent
b91f9fcc2d
commit
db2e8c3157
@ -628,10 +628,15 @@ class DetectionService:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _resolve_hub_customer_id(row: Dict[str, Any]) -> Optional[int]:
|
def _resolve_hub_customer_id(row: Dict[str, Any]) -> Optional[int]:
|
||||||
value = row.get("hub_customer_id") or row.get("customer_key")
|
value = row.get("hub_customer_id")
|
||||||
if isinstance(value, int):
|
if not isinstance(value, int):
|
||||||
return value
|
return None
|
||||||
return None
|
|
||||||
|
customer = execute_query_single(
|
||||||
|
"SELECT id FROM customers WHERE id = %s",
|
||||||
|
(value,),
|
||||||
|
)
|
||||||
|
return value if customer else None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _resolve_customer_name(hub_customer_id: Optional[int], fallback: Optional[str]) -> Optional[str]:
|
def _resolve_customer_name(hub_customer_id: Optional[int], fallback: Optional[str]) -> Optional[str]:
|
||||||
|
|||||||
@ -179,6 +179,30 @@ def test_detection_service_reopens_expired_ignored_issue(monkeypatch):
|
|||||||
assert "ignored_until = NULL" in updates[0][0]
|
assert "ignored_until = NULL" in updates[0][0]
|
||||||
|
|
||||||
|
|
||||||
|
def test_detection_service_ignores_non_hub_customer_keys(monkeypatch):
|
||||||
|
from app.modules.invoice_error_finder.services.detection_service import DetectionService
|
||||||
|
|
||||||
|
def fake_execute_query_single(query, params=None):
|
||||||
|
if "SELECT id FROM customers" in query:
|
||||||
|
return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"app.modules.invoice_error_finder.services.detection_service.execute_query_single",
|
||||||
|
fake_execute_query_single,
|
||||||
|
)
|
||||||
|
|
||||||
|
service = DetectionService()
|
||||||
|
customer_id = service._resolve_hub_customer_id(
|
||||||
|
{
|
||||||
|
"customer_key": 56283338,
|
||||||
|
"hub_customer_id": None,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
assert customer_id is None
|
||||||
|
|
||||||
|
|
||||||
def test_list_issues_supports_unassigned_filter(monkeypatch):
|
def test_list_issues_supports_unassigned_filter(monkeypatch):
|
||||||
from app.modules.invoice_error_finder.backend.router import list_issues
|
from app.modules.invoice_error_finder.backend.router import list_issues
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user