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

Fix Impression Events - Variation lookup by id and Experiment id #350

Merged
merged 2 commits into from
Jul 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions optimizely/event/user_event_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Optimizely
# Copyright 2019, 2021 Optimizely
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -45,12 +45,12 @@ def create_impression_event(
if not activated_experiment and rule_type is not enums.DecisionSources.ROLLOUT:
return None

variation, experiment_key = None, None
variation, experiment_id = None, None
if activated_experiment:
experiment_key = activated_experiment.key
experiment_id = activated_experiment.id

if variation_id and experiment_key:
variation = project_config.get_variation_from_id(experiment_key, variation_id)
if variation_id and experiment_id:
variation = project_config.get_variation_from_id_by_experiment_id(experiment_id, variation_id)
event_context = user_event.EventContext(
project_config.account_id, project_config.project_id, project_config.revision, project_config.anonymize_ip,
)
Expand Down