From 4b324d001345d20b007107e506b89fbfe45b725d Mon Sep 17 00:00:00 2001 From: Jake Brown Date: Thu, 15 Jul 2021 13:23:49 -0400 Subject: [PATCH] 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. --- optimizely/event/user_event_factory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/optimizely/event/user_event_factory.py b/optimizely/event/user_event_factory.py index 94ca8638..1db9fc95 100644 --- a/optimizely/event/user_event_factory.py +++ b/optimizely/event/user_event_factory.py @@ -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 @@ -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, )