fix: collect sources for state corp corporations
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 32s
CI/CD Pipeline / Build and Push Images (push) Successful in 1s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 1s
CI/CD Pipeline / Quality Gate (pull_request) Successful in 30s
CI/CD Pipeline / Build and Push Images (pull_request) Successful in 1s
CI/CD Pipeline / Internal Notify (pull_request) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (pull_request) Successful in 1s
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 32s
CI/CD Pipeline / Build and Push Images (push) Successful in 1s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 1s
CI/CD Pipeline / Quality Gate (pull_request) Successful in 30s
CI/CD Pipeline / Build and Push Images (pull_request) Successful in 1s
CI/CD Pipeline / Internal Notify (pull_request) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (pull_request) Successful in 1s
This commit is contained in:
@@ -178,6 +178,17 @@ def _resolve_lookup_limit(
|
||||
return max(resolved, 0)
|
||||
|
||||
|
||||
def _rosatom_roscosmos_scope_query() -> Q:
|
||||
"""Вернуть условие принадлежности к контуру Росатома или Роскосмоса."""
|
||||
return (
|
||||
Q(gk_name__icontains="Росатом")
|
||||
| Q(gk_name__icontains="Роскосмос")
|
||||
| Q(gk_code__iexact="rosatom")
|
||||
| Q(gk_code__iexact="roscosmos")
|
||||
| Q(gk_code__iexact="roskosmos")
|
||||
)
|
||||
|
||||
|
||||
def _active_registry_lookup_targets(
|
||||
*,
|
||||
limit: int | None = None,
|
||||
@@ -186,7 +197,9 @@ def _active_registry_lookup_targets(
|
||||
organization_ids: list[str] | None = None,
|
||||
) -> list[RegistryLookupTarget]:
|
||||
"""Вернуть организации, которые сейчас состоят хотя бы в одном реестре."""
|
||||
queryset = SourceOrganization.objects.filter(opk_registry_membership=True)
|
||||
queryset = SourceOrganization.objects.filter(
|
||||
Q(opk_registry_membership=True) | _rosatom_roscosmos_scope_query()
|
||||
)
|
||||
if organization_ids is not None:
|
||||
queryset = queryset.filter(uid__in=organization_ids)
|
||||
if require_inn:
|
||||
@@ -3977,6 +3990,7 @@ def _active_fns_registry_inns(*, limit: int) -> list[str]:
|
||||
Q(opk_registry_membership=True)
|
||||
| Q(goz_participation=True)
|
||||
| ~Q(ropk_num="")
|
||||
| _rosatom_roscosmos_scope_query()
|
||||
)
|
||||
.exclude(inn="")
|
||||
.order_by("inn")
|
||||
|
||||
@@ -89,4 +89,29 @@ class CheckoCollectionClaimTest(TestCase):
|
||||
checko_source=CheckoCollectionAttempt.Source.INSPECTIONS,
|
||||
)
|
||||
|
||||
self.assertEqual([target.organization_id for target in targets], [str(second.id)])
|
||||
self.assertEqual(
|
||||
[target.organization_id for target in targets], [str(second.id)]
|
||||
)
|
||||
|
||||
def test_lookup_targets_include_corporation_members_outside_opk(self):
|
||||
self.organization.gk_name = 'Госкорпорация "Росатом"'
|
||||
self.organization.save(update_fields=["gk_name"])
|
||||
outside_scope = create_directory_organization(
|
||||
pn_name='ООО "Вне контура обмена"',
|
||||
mn_ogrn=1027700000399,
|
||||
mn_inn=7701000399,
|
||||
in_kpp=770101001,
|
||||
mn_okpo="11223344",
|
||||
)
|
||||
|
||||
targets = parser_tasks._active_registry_lookup_targets(
|
||||
organization_ids=[
|
||||
str(self.organization.id),
|
||||
str(outside_scope.id),
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
[target.organization_id for target in targets],
|
||||
[str(self.organization.id)],
|
||||
)
|
||||
|
||||
@@ -1307,6 +1307,26 @@ class FNSApiSyncTaskTestCase(TestCase):
|
||||
|
||||
self.assertEqual(targets, ["1000000001", "1000000002"])
|
||||
|
||||
def test_active_registry_targets_include_corporation_members_outside_opk(self):
|
||||
OrganizationFactory(
|
||||
inn="1000000010",
|
||||
gk_name='Госкорпорация "Роскосмос"',
|
||||
opk_registry_membership=False,
|
||||
goz_participation=False,
|
||||
ropk_num="",
|
||||
)
|
||||
OrganizationFactory(
|
||||
inn="1000000011",
|
||||
gk_name="",
|
||||
opk_registry_membership=False,
|
||||
goz_participation=False,
|
||||
ropk_num="",
|
||||
)
|
||||
|
||||
targets = parser_tasks._active_fns_registry_inns(limit=10)
|
||||
|
||||
self.assertEqual(targets, ["1000000010"])
|
||||
|
||||
|
||||
@override_settings(
|
||||
CELERY_TASK_ALWAYS_EAGER=True,
|
||||
|
||||
Reference in New Issue
Block a user