Skip to content

Commit f448bb1

Browse files
committed
Resolved issues as per feedback
1 parent e13b143 commit f448bb1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/optimizely-sdk/lib/core/decision_service/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,13 @@ DecisionService.prototype.__saveUserProfile = function(experiment, variation, us
263263
}
264264

265265
try {
266-
var newBucketMap = experimentBucketMap;
267-
newBucketMap[experiment.id] = {
266+
experimentBucketMap[experiment.id] = {
268267
variation_id: variation.id
269268
};
270269

271270
this.userProfileService.save({
272271
user_id: userId,
273-
experiment_bucket_map: newBucketMap,
272+
experiment_bucket_map: experimentBucketMap,
274273
});
275274

276275
this.logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.SAVED_VARIATION, MODULE_NAME, variation.key, experiment.key, userId));

packages/optimizely-sdk/lib/core/project_config/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
* @return {Object} Object representing project configuration
3636
*/
3737
createProjectConfig: function(datafile) {
38-
var projectConfig = datafile;
38+
var projectConfig = fns.assign({}, datafile);
3939

4040
/*
4141
* Conditions of audiences in projectConfig.typedAudiences are not
@@ -60,7 +60,7 @@ module.exports = {
6060
});
6161

6262
projectConfig.rolloutIdMap = fns.keyBy(projectConfig.rollouts || [], 'id');
63-
jsSdkUtils.objectValues(projectConfig.rolloutIdMap || {}).forEach(function (rollout) {
63+
jsSdkUtils.objectValues(projectConfig.rolloutIdMap || {}).forEach(function (rollout) {
6464
(rollout.experiments || []).forEach(function(experiment) {
6565
projectConfig.experiments.push(experiment);
6666
// Creates { <variationKey>: <variation> } map inside of the experiment

packages/optimizely-sdk/lib/utils/attributes_validator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333
*/
3434
validate: function(attributes) {
3535
if (typeof attributes === 'object' && !Array.isArray(attributes) && attributes !== null) {
36-
Object.keys(attributes).map(function(key) {
36+
Object.keys(attributes).forEach(function(key) {
3737
if (typeof attributes[key] === 'undefined') {
3838
throw new Error(sprintf(ERROR_MESSAGES.UNDEFINED_ATTRIBUTE, MODULE_NAME, key));
3939
}

0 commit comments

Comments
 (0)