Skip to content

Commit

Permalink
Fix #812: fix Acoustic create_timestamp column (#813)
Browse files Browse the repository at this point in the history
* Fix #812: fix Acoustic create_timestamp column

* Fix issue number in comment
  • Loading branch information
leplatrem authored Sep 7, 2023
1 parent f23c37d commit de9a6a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ctms/acoustic_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ def _main_table_converter(self, contact, main_fields):
self.context["trace"] = inner_value

if acoustic_field_name in main_fields:
# TODO: The create_timestamp is currently a Date field in Acoustic.
# Sending time information will prevent Acoustic to set the value properly.
# We should configure Acoustic to use a Timestamp for this data.
# This is being tracked in https://github.com/mozilla-it/ctms-api/issues/563
if acoustic_field_name == "create_timestamp":
inner_value = inner_value.date()

if acoustic_field_name == "fxa_created_date":
inner_value = self.fxa_created_date_string_to_datetime(
inner_value
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_acoustic_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ def test_ctms_to_acoustic_minimal_fields(
waitlist_acoustic_fields,
acoustic_newsletters_mapping,
)
assert main[
"create_timestamp"
] == minimal_contact.email.create_timestamp.date().strftime("%m/%d/%Y")
assert main["email"] == minimal_contact.email.primary_email
assert main["basket_token"] == str(minimal_contact.email.basket_token)
assert main["mailing_country"] == minimal_contact.email.mailing_country
Expand Down

0 comments on commit de9a6a1

Please sign in to comment.