-
Notifications
You must be signed in to change notification settings - Fork 28
Feature Notification Center #73
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
Feature Notification Center #73
Conversation
|
Can one of the admins verify this patch? |
| * @param array $args Array of items to pass as arguments to the callback | ||
| * | ||
| */ | ||
| public function fireNotifications($notification_type, array $args = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change this to sendNotifications?
src/Optimizely/Optimizely.php
Outdated
| $featureFlagKey, | ||
| $userId, | ||
| $attributes, | ||
| $audience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are passing back an array of audiences. it should be the audience that the user fit. right now it will be an array of one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I am confused on why are we always picking the first audience. Please see my comment here
https://github.com/optimizely/python-sdk/pull/88/files/8d4c3b2476fc7e5e4f1dc8504fb7068e8065a327#diff-2340ceb056ad364022b798c358a6c8ffR399
| $this->_logger->log(Logger::ERROR, sprintf( | ||
| 'Unable to dispatch conversion event. Error %s', $exception->getMessage())); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the sendImpression. Why not add a sendConversion as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendImpression logic got separated from activate when we implemented isFeatureEnabled that had to send an impression event as well. Track is the only method right now that sends a conversion event. Separating out unit tests for sendConversion will require a lot of changes. Shall I do it in this PR or can we do it later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it later if necessary.
…-NotificationCenter # Conflicts: # src/Optimizely/Optimizely.php # src/Optimizely/ProjectConfig.php # tests/OptimizelyTest.php # tests/UtilsTests/VariableTypeUtilsTest.php
thomaszurkan-optimizely
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see where you were testing that all the correct type arguments are passed for ACTIVATE, and TRACK callbacks. Did I miss something?
| class NotificationType | ||
| { | ||
| // format is EVENT: list of parameters to callback. | ||
| const ACTIVATE = "ACTIVATE:experiment, user_id,attributes, variation, event"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space after attributes
| $this->_logger->log(Logger::ERROR, sprintf( | ||
| 'Unable to dispatch conversion event. Error %s', $exception->getMessage())); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it later if necessary.
|
@thomaszurkan-optimizely The unit tests for sendImpression verify that it's fireNotifications is called with expected params for ACTIVATE For Track, I verify that fireNotifications is called with expected params. Such as here |
…ilhussain/php-sdk into Feature-NotificationCenter
1 similar comment
| } | ||
|
|
||
| $variationId = $experimentToVariationMap[$experimentId]; | ||
| // check for null and empty string variation ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already enforce these checks in setForcedVariation
|
|
||
| $variation = $this->getVariationFromId($experimentKey, $variationId); | ||
| $variationKey = $variation->getKey(); | ||
| // check if the variation exists in the datafile (a new variation is returned if it is not in the datafile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
E2E tests are passing. Merging in. |
Contains changes of #71
Covered Unit Tests
Notification Listener
Optimizely
Note: Separate sendImpression unit testing from activate unit tests and verify that activate calls/not calls send impression given scenario
sendImpression
track Verify calls fireNotification where relevant ✔️
isFeatureEnabled calls fireNotification both with source Experiment and source Rollout ✔️