Skip to content

feat(decision-listener): Incorporated new decision notification listener changes. #258

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

Merged
merged 5 commits into from
Apr 18, 2019

Conversation

mfahadahmed
Copy link
Contributor

Summary

  • Incorporated new decision notification listener changes.

Test plan

  • Added unit tests.

@coveralls
Copy link

coveralls commented Apr 16, 2019

Coverage Status

Coverage decreased (-0.03%) to 97.805% when pulling 6910430 on fahad/decision-listener-new-changes into fa909dd on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 97.837% when pulling aae9e19 on fahad/decision-listener-new-changes into fa909dd on master.

FEATURE: 'feature',
FEATURE_TEST: 'feature-test',
FEATURE_VARIABLE: 'feature_variable',
Copy link
Contributor

Choose a reason for hiding this comment

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

Missed it earlier. This needs to be feature-variable

@@ -89,10 +89,16 @@ module.exports = {

projectConfig.forcedVariationMap = {};

// Object containing experiment Ids that exist in any feature
// for checking that experiment is a feature experiment or not.
projectConfig.featureExperimentsMap = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

More meaningful is experimentFeatureMap.

projectConfig.featureKeyMap = fns.keyBy(projectConfig.featureFlags || [], 'key');
fns.forOwn(projectConfig.featureKeyMap, function(feature) {
feature.variableKeyMap = fns.keyBy(feature.variables, 'key');
fns.forEach(feature.experimentIds || [], function(experimentId) {
// Add this experiment in feature experiment map.
projectConfig.featureExperimentsMap[experimentId] = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of true, if we can assign featureId would be more meaning. @aliabbasrizvi What do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. It would be much better if we add featureId on experiment and use that.

* any feature, false otherwise.
*/
isFeatureExperiment: function(projectConfig, experimentId) {
return projectConfig.featureExperimentsMap[experimentId];
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition after making suggested changes, should be like
projectConfig.featureExperimentsMap[experimentId] != undefined

Copy link
Contributor

@aliabbasrizvi aliabbasrizvi left a comment

Choose a reason for hiding this comment

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

Looks good.

@aliabbasrizvi aliabbasrizvi merged commit cc5ffee into master Apr 18, 2019
@aliabbasrizvi aliabbasrizvi deleted the fahad/decision-listener-new-changes branch April 18, 2019 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants