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

[EP-157] Fix Properties (Phase One) #1371

Merged
merged 3 commits into from
Feb 11, 2021
Merged

Conversation

singhhari
Copy link
Contributor

📲 What

This PR continues the ongoing work for phase one of our analytics overhaul. The changes, included in here, are primarily renaming and moving properties and their values to their newly defined areas.

🤔 Why

The properties provided context for each of our events and the Insights team has a defined set of criteria for them.

@@ -115,16 +113,8 @@ public func optimizelyProperties(environment: Environment? = AppEnvironment.curr
}

let allExperiments = optimizelyClient.allExperiments().map { experimentKey -> [String: String] in
let variation = try? optimizelyClient.getVariationKey(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of relevant pieces of context:

  • in phase 8 we are essentially deprecating the entirety of optimizelyProperties
  • insights wants the format to be session_variants_optimizely : [experimentKey1: variation, experimentKey2: variation ...]

I decided to delete some of these properties here because after making the change to the format of session_variants_optimizely i realized those other values were not being used for anything.

.multiplyingCurrency(100.0)
.rounded()
// Two decimal places to represent cent values
let pledgeTotalUsd = rounded(pledgeTotal.multiplyingCurrency(staticUsdRate), places: 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is used in a core flow for checkout. Can we add tests for the way we are using it if we don't have them already

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix here entails changing the original representation of cents into a dollar + cents value (e.g. 1015 cents -> 10.15). It turns out that we already have a handful of tests written in the PledgeViewModelTests file. A lot of them broke after the fix which made sense because our templates had cent values that all needed to be updated. I want to note, however, that the change here is specifically occurring in the checkoutPropertiesData function which is only used for events/tracking and not rendering components of the UI, from my observation.

After I fixed the templates and tests, it appears our coverage for both this method and the entire PledgeViewModel are good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thank you!

@singhhari singhhari requested a review from jgsamudio February 11, 2021 21:55
@singhhari singhhari merged commit 49b8490 into master Feb 11, 2021
@singhhari singhhari deleted the EP-157/fix-properties-phase-one branch February 11, 2021 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants