fix: align source API and exchange demo data
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 30s
CI/CD Pipeline / Build and Push Images (push) Successful in 0s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 0s
CI/CD Pipeline / Quality Gate (pull_request) Successful in 31s
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:
2026-07-22 17:20:39 +02:00
parent 9635cd81d7
commit 4be9e702c3
8 changed files with 411 additions and 40 deletions

View File

@@ -35,7 +35,6 @@ from django.conf import settings
from django.db.models import Q
from django.utils import timezone
from organizations.models import Organization, OrganizationSourceRecord
from organizations.test_companies import TestCompanyDatasetService
class StateCorpExchangeError(ValueError):
@@ -290,9 +289,7 @@ class StateCorpExchangeService:
@classmethod
def _rosatom_roscosmos_queryset(cls):
queryset = Organization.objects.exclude(inn="").exclude(
uid__in=TestCompanyDatasetService.company_uids()
)
queryset = Organization.objects.exclude(inn="")
name_query = Q()
for keyword in cls.ROSATOM_ROSCOSMOS_GK_NAME_KEYWORDS:
name_query |= Q(gk_name__icontains=keyword)

View File

@@ -893,6 +893,11 @@ class GenericParserRecordService(BulkOperationsMixin, BaseService[GenericParserR
records_by_source: dict[str, list[SourceRecordInput]] = defaultdict(list)
for (record_source, _external_id), record in unique_records.items():
record_date = record.record_date
if record_source in cls.vacancy_record_sources | {
ParserLoadLog.Source.ARBITRATION
}:
record_date = _date_to_iso(normalize_to_date(record.record_date)) or ""
payload = dict(record.payload) if isinstance(record.payload, dict) else {}
payload.update(
{
@@ -903,7 +908,7 @@ class GenericParserRecordService(BulkOperationsMixin, BaseService[GenericParserR
"ogrn": record.ogrn,
"organisation_name": record.organisation_name,
"title": record.title,
"record_date": record.record_date,
"record_date": record_date,
"amount": str(record.amount) if record.amount is not None else None,
"status": record.status,
"url": record.url,
@@ -916,7 +921,7 @@ class GenericParserRecordService(BulkOperationsMixin, BaseService[GenericParserR
organization_name=record.organisation_name,
inn=record.inn,
ogrn=record.ogrn,
record_date=record.record_date,
record_date=record_date,
amount=record.amount,
status=record.status,
url=record.url,
@@ -1503,7 +1508,7 @@ class InspectionService(BulkOperationsMixin, BaseService[InspectionRecord]):
organization_name=insp.organisation_name,
inn=insp.inn,
ogrn=insp.ogrn,
record_date=insp.start_date,
record_date=_date_to_iso(normalize_to_date(insp.start_date)) or "",
status=insp.status,
payload={
"load_batch": batch_id,