This commit is contained in:
@@ -8,6 +8,7 @@ from django.utils import timezone
|
||||
|
||||
from apps.jobs.models import Employer, FieldProvenance, JobPosting, JobSourceAlias, JobVersion
|
||||
from apps.profiles.models import SearchProfile
|
||||
from apps.sources.adapters.base import FieldEvidence
|
||||
from apps.sources.adapters.registry import registry
|
||||
from apps.sources.models import RawDocument, Source
|
||||
from apps.sources.services.policy import is_denied_domain
|
||||
@@ -89,7 +90,10 @@ def _source_is_direct(source: Source | None, draft: CanonicalJobDraft) -> bool:
|
||||
host = (urlsplit(draft.canonical_url).hostname or "").lower()
|
||||
if is_denied_domain(host):
|
||||
return False
|
||||
return bool(source and source.source_type == Source.Type.EMPLOYER)
|
||||
if not source:
|
||||
return False
|
||||
metadata = source.metadata if isinstance(source.metadata, dict) else {}
|
||||
return source.source_type == Source.Type.EMPLOYER or metadata.get("direct_employer") is True
|
||||
|
||||
|
||||
def _alias_payload(
|
||||
@@ -314,6 +318,22 @@ def process_raw_document(document: RawDocument) -> dict[str, int | str | list[st
|
||||
)
|
||||
created = updated = duplicates = 0
|
||||
for extracted in result.jobs:
|
||||
source_metadata = (
|
||||
document.source.metadata
|
||||
if document.source and isinstance(document.source.metadata, dict)
|
||||
else {}
|
||||
)
|
||||
configured_employer = str(source_metadata.get("employer_name") or "").strip()
|
||||
if configured_employer:
|
||||
extracted.employer_name = configured_employer
|
||||
extracted.evidence.append(
|
||||
FieldEvidence(
|
||||
"employer_name",
|
||||
"reviewed-source-config",
|
||||
0.99,
|
||||
configured_employer,
|
||||
)
|
||||
)
|
||||
draft = normalize_extracted_job(extracted)
|
||||
_, decision, was_created = persist_draft(
|
||||
draft,
|
||||
|
||||
Reference in New Issue
Block a user