Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #812: fix Acoustic create_timestamp column #813

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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