Skip to content

Commit 4b324d0

Browse files
Fix Impression Events - Variation lookup by id and Experiment id (#350)
* Fix in user_event_factory to use experiment_id to lookup variation for impression events. * Update License Header to 2021.
1 parent ab89cf4 commit 4b324d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

optimizely/event/user_event_factory.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019 Optimizely
1+
# Copyright 2019, 2021 Optimizely
22
# Licensed under the Apache License, Version 2.0 (the "License");
33
# you may not use this file except in compliance with the License.
44
# You may obtain a copy of the License at
@@ -45,12 +45,12 @@ def create_impression_event(
4545
if not activated_experiment and rule_type is not enums.DecisionSources.ROLLOUT:
4646
return None
4747

48-
variation, experiment_key = None, None
48+
variation, experiment_id = None, None
4949
if activated_experiment:
50-
experiment_key = activated_experiment.key
50+
experiment_id = activated_experiment.id
5151

52-
if variation_id and experiment_key:
53-
variation = project_config.get_variation_from_id(experiment_key, variation_id)
52+
if variation_id and experiment_id:
53+
variation = project_config.get_variation_from_id_by_experiment_id(experiment_id, variation_id)
5454
event_context = user_event.EventContext(
5555
project_config.account_id, project_config.project_id, project_config.revision, project_config.anonymize_ip,
5656
)

0 commit comments

Comments
 (0)