Skip to content

Commit

Permalink
CM-1004: added opensearch synch for enrollment after bulk upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Oct 8, 2024
1 parent 43ecf9b commit ad74ed4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions social_protection/signals/on_validation_import_valid_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, workflow: str, upload_record, upload_id: str, benefit_plan: B

def on_task_complete_action(business_event, **kwargs):
from social_protection.apps import SocialProtectionConfig
from social_protection.services import BeneficiaryImportService

result = kwargs.get('result')
if not result or not result.get('success'):
Expand Down Expand Up @@ -111,6 +112,10 @@ def on_task_complete_action(business_event, **kwargs):
new_beneficiaries.append(beneficiary)
try:
Beneficiary.objects.bulk_create(new_beneficiaries)
BeneficiaryImportService(user).synchronize_data_for_reporting(
upload_id=data['task']['json_ext']['data_upload_id'],
benefit_plan=data['task']['json_ext']['benefit_plan_id']
)
except ValidationError as e:
logger.error(f"Validation error occurred: {e}")
return
Expand Down

0 comments on commit ad74ed4

Please sign in to comment.