Skip to content

Commit 8ea5471

Browse files
authored
Merge pull request #5826 from uktrade/fix-great-date-to-form-date
change great activity to use form_created_at
2 parents b6469d7 + 7fcc57c commit 8ea5471

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

datahub/company_activity/models/great.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def save(self, *args, **kwargs):
124124
great_export_enquiry_id=self.id,
125125
activity_source=CompanyActivity.ActivitySource.great_export_enquiry,
126126
defaults={
127-
'date': self.created_on,
127+
'date': self.form_created_at,
128128
'company_id': self.company_id,
129129
},
130130
)

datahub/company_activity/tasks/sync.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ def relate_company_activity_to_great(batch_size=500):
148148

149149
great_export_enquiries = GreatExportEnquiry.objects.filter(
150150
company_id__isnull=False,
151-
).values('id', 'created_on', 'company_id')
151+
).values('id', 'form_created_at', 'company_id')
152152

153153
objs = [
154154
CompanyActivity(
155155
great_export_enquiry_id=great_export_enquiry['id'],
156-
date=great_export_enquiry['created_on'],
156+
date=great_export_enquiry['form_created_at'],
157157
company_id=great_export_enquiry['company_id'],
158158
activity_source=CompanyActivity.ActivitySource.great_export_enquiry,
159159
)

datahub/company_activity/tests/models/test_great_export_enquiry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_save(self):
2222
great_export_enquiry_id=great_export_enquiry.id,
2323
)
2424
assert company_activity.company_id == great_export_enquiry.company_id
25-
assert company_activity.date == great_export_enquiry.created_on
25+
assert company_activity.date == great_export_enquiry.form_created_at
2626
assert (
2727
company_activity.activity_source == CompanyActivity.ActivitySource.great_export_enquiry
2828
)

datahub/company_activity/tests/test_tasks/test_great_task.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_great_export_enquiry_are_copied_to_company_activity(self):
3535
company_activity = CompanyActivity.objects.get(
3636
great_export_enquiry_id=great_export_enquiry.id,
3737
)
38-
assert company_activity.date == great_export_enquiry.created_on
38+
assert company_activity.date == great_export_enquiry.form_created_at
3939
assert (
4040
company_activity.activity_source == CompanyActivity.ActivitySource.great_export_enquiry
4141
)

datahub/search/company_activity/dict_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def activity_great_dict(obj):
7878

7979
return {
8080
'id': str(obj.id),
81-
'created_on': obj.created_on,
81+
'form_created_at': obj.form_created_at,
8282
'meta_full_name': obj.meta_full_name,
8383
'meta_email_address': obj.meta_email_address,
8484
'contact': dict_utils.contact_job_dict(obj.contact),

datahub/search/company_activity/fields.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def activity_great_field():
7070
return Object(
7171
properties={
7272
'id': Keyword(),
73-
'created_on': Date(),
73+
'form_created_at': Date(),
7474
'meta_full_name': Text(index=False),
7575
'meta_email_address': Text(index=False),
7676
'contact': fields.contact_job_field(),

datahub/search/company_activity/test/test_dict_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_activity_great_dict():
8383
result = dict_utils.activity_great_dict(great)
8484

8585
assert result['id'] == str(great.id)
86-
assert result['created_on'] == great.created_on
86+
assert result['form_created_at'] == great.form_created_at
8787
assert result['meta_full_name'] == great.meta_full_name
8888
assert result['meta_email_address'] == great.meta_email_address
8989
assert result['contact']['id'] == str(great.contact.id)

datahub/search/company_activity/test/test_models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def test_company_activity_great_to_dict():
272272
'order': company_activity.order,
273273
'great_export_enquiry': {
274274
'id': str(great.id),
275-
'created_on': great.created_on,
275+
'form_created_at': great.form_created_at,
276276
'meta_full_name': great.meta_full_name,
277277
'meta_email_address': great.meta_email_address,
278278
'contact': {

0 commit comments

Comments
 (0)