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

refact(Condition Evaluator): Make Condition Evaluation simpler - Ignore comments #11

Closed
wants to merge 3 commits into from

Conversation

oakbani
Copy link
Collaborator

@oakbani oakbani commented Oct 3, 2018

Python SDK as of now, has a bit complex condition evaluation. Before modifying evaluator for audience match type work, this simplifies the condition evaluator and makes it more like how it's done in Ruby, PHP.

Currently, In python we have conditions list and structure.
The structure stores decoded conditions string with { } replaced by an integer placeholder.
And the conditions list is a list of those replaced { } conditions.
This PR removes this undesired complexity. And directly decodes conditions string as in other SDKs.
This will make audience type work easier, where we will be checking match type/ attribute types. etc.

@@ -30,8 +31,7 @@ class ConditionalOperatorTypes(object):
class ConditionEvaluator(object):
""" Class encapsulating methods to be used in audience condition evaluation. """

def __init__(self, condition_data, attributes):
self.condition_data = condition_data
def __init__(self, attributes):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can be instantiated with attributes, that is stored as instance variable. As this remains common for multiple audience evaluation.
evaluate method accepts the condition structure

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 99.662% when pulling 1640b20 on oakbani/refact-condition-evaluator into af38afb on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 99.662% when pulling 1640b20 on oakbani/refact-condition-evaluator into af38afb on master.

@coveralls
Copy link

coveralls commented Oct 3, 2018

Coverage Status

Coverage decreased (-0.005%) to 99.662% when pulling bf3247f on oakbani/refact-condition-evaluator into af38afb on master.

@oakbani oakbani closed this Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants