Skip to content

Commit

Permalink
Merge pull request #5826 from uktrade/fix-great-date-to-form-date
Browse files Browse the repository at this point in the history
change great activity to use form_created_at
  • Loading branch information
bau123 authored Nov 26, 2024
2 parents b6469d7 + 7fcc57c commit 8ea5471
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datahub/company_activity/models/great.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def save(self, *args, **kwargs):
great_export_enquiry_id=self.id,
activity_source=CompanyActivity.ActivitySource.great_export_enquiry,
defaults={
'date': self.created_on,
'date': self.form_created_at,
'company_id': self.company_id,
},
)
4 changes: 2 additions & 2 deletions datahub/company_activity/tasks/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def relate_company_activity_to_great(batch_size=500):

great_export_enquiries = GreatExportEnquiry.objects.filter(
company_id__isnull=False,
).values('id', 'created_on', 'company_id')
).values('id', 'form_created_at', 'company_id')

objs = [
CompanyActivity(
great_export_enquiry_id=great_export_enquiry['id'],
date=great_export_enquiry['created_on'],
date=great_export_enquiry['form_created_at'],
company_id=great_export_enquiry['company_id'],
activity_source=CompanyActivity.ActivitySource.great_export_enquiry,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_save(self):
great_export_enquiry_id=great_export_enquiry.id,
)
assert company_activity.company_id == great_export_enquiry.company_id
assert company_activity.date == great_export_enquiry.created_on
assert company_activity.date == great_export_enquiry.form_created_at
assert (
company_activity.activity_source == CompanyActivity.ActivitySource.great_export_enquiry
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_great_export_enquiry_are_copied_to_company_activity(self):
company_activity = CompanyActivity.objects.get(
great_export_enquiry_id=great_export_enquiry.id,
)
assert company_activity.date == great_export_enquiry.created_on
assert company_activity.date == great_export_enquiry.form_created_at
assert (
company_activity.activity_source == CompanyActivity.ActivitySource.great_export_enquiry
)
Expand Down
2 changes: 1 addition & 1 deletion datahub/search/company_activity/dict_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def activity_great_dict(obj):

return {
'id': str(obj.id),
'created_on': obj.created_on,
'form_created_at': obj.form_created_at,
'meta_full_name': obj.meta_full_name,
'meta_email_address': obj.meta_email_address,
'contact': dict_utils.contact_job_dict(obj.contact),
Expand Down
2 changes: 1 addition & 1 deletion datahub/search/company_activity/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def activity_great_field():
return Object(
properties={
'id': Keyword(),
'created_on': Date(),
'form_created_at': Date(),
'meta_full_name': Text(index=False),
'meta_email_address': Text(index=False),
'contact': fields.contact_job_field(),
Expand Down
2 changes: 1 addition & 1 deletion datahub/search/company_activity/test/test_dict_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_activity_great_dict():
result = dict_utils.activity_great_dict(great)

assert result['id'] == str(great.id)
assert result['created_on'] == great.created_on
assert result['form_created_at'] == great.form_created_at
assert result['meta_full_name'] == great.meta_full_name
assert result['meta_email_address'] == great.meta_email_address
assert result['contact']['id'] == str(great.contact.id)
Expand Down
2 changes: 1 addition & 1 deletion datahub/search/company_activity/test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def test_company_activity_great_to_dict():
'order': company_activity.order,
'great_export_enquiry': {
'id': str(great.id),
'created_on': great.created_on,
'form_created_at': great.form_created_at,
'meta_full_name': great.meta_full_name,
'meta_email_address': great.meta_email_address,
'contact': {
Expand Down

0 comments on commit 8ea5471

Please sign in to comment.