-
Notifications
You must be signed in to change notification settings - Fork 19
restructuring code to fit audience condition into existing code. #38
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
Conversation
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.
Mostly good, I have a few suggestions!
@@ -26,14 +26,15 @@ type Audience struct { | |||
// Experiment represents an Experiment object from the Optimizely datafile | |||
type Experiment struct { | |||
// @TODO(mng): include audienceConditions |
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 remove this comment from me 😄
switch v := node.Item.(type) { | ||
case entities.Condition: | ||
evaluator := CustomAttributeConditionEvaluator{} | ||
result, err = evaluator.Evaluate(node.Item, condTreeParams) |
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.
If we are already special casing here, why not make the evaluator.Evaluate( )
take in the typed Condition
instead of an interface. And the same for the AudienceConditionEvaluator
since we already know that the item we are evaluating is a string?
if !evalResult { | ||
// user not targeted for experiment, return an empty variation | ||
experimentDecision.DecisionMade = true | ||
experimentDecision.Variation = entities.Variation{} |
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.
This line isn't needed right since it'll just be the default zero-value Variation
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.
lgtm
# Conflicts: # optimizely/decision/experiment_targeting_service.go
No description provided.