From 42f27e039608c8cf62a79f296c6703f154814c7c Mon Sep 17 00:00:00 2001 From: Edoardo Conti Date: Thu, 4 Jun 2020 11:14:29 -0700 Subject: [PATCH] Add support for null experiment data (#52) --- static/js/banditLocal.js | 24 ++++++++++-------------- static/js/banditMl.js | 2 +- templates/productDescription.html | 21 +++++++++------------ 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/static/js/banditLocal.js b/static/js/banditLocal.js index 8317a7b..fa1c99d 100644 --- a/static/js/banditLocal.js +++ b/static/js/banditLocal.js @@ -1,14 +1,10 @@ -// 16ounc.es -// let experimentId = "01c14c21-b66a-408b-89ba-7d888f0c35de"; -// let bandit = new banditml.BanditAPI("a48853ba-6c5a-3202-8711-4ce878833cb3", {[experimentId]: "recs"}, {debugMode: true, banditHostUrl: "https://www.16ounc.es/api/"}); -// local -// product set case -// let experimentId = "18c08829-e49e-421f-a13b-77e7d6d0221b"; -// product set multi-dynamic case -let experimentId = "fce763c5-eaf6-4b4d-ae42-47d62ecf04ab"; -// category case -// let experimentId = "59204365-5e27-4c8c-a21b-e1a81d373979"; -function getSessionIdCustom () { - return "1235" -} -let bandit = new banditml.BanditAPI("c52e1439-77bc-3cfd-b422-6a4d9a1e2c8c", {[experimentId]: "recsCategory"}, {debugMode: true, debugOptions: {forceVariantSlug: "control"}, banditHostUrl: "http://localhost:8000/api/", getSessionId: getSessionIdCustom}); +let experimentId = "84a8cc7a-9156-41fb-af9d-8001c8e1897b"; +let bandit = new banditml.BanditAPI( + apiKey = "6bd9ba8f-bd71-3139-a6e5-41275f34afe9", + recClassByExperimentId = {[experimentId]: "product-recs"}, + config = { + debugMode: true, + banditHostUrl: "http://localhost:8000/api/", + debugOptions: {forceVariantSlug: "bandit"} + } +); diff --git a/static/js/banditMl.js b/static/js/banditMl.js index cdf9f74..20cca75 100644 --- a/static/js/banditMl.js +++ b/static/js/banditMl.js @@ -649,7 +649,7 @@ banditml.BanditAPI.prototype.logDecision = function(context, decisionResponse, e }); }; -banditml.BanditAPI.prototype.logReward = function(reward, experimentId, decision = null, decisionId = null) { +banditml.BanditAPI.prototype.logReward = function(reward, experimentId = null, decision = null, decisionId = null) { const headers = { "Authorization": `ApiKey ${this.banditApikey}` }; diff --git a/templates/productDescription.html b/templates/productDescription.html index baf27ab..555b7c2 100644 --- a/templates/productDescription.html +++ b/templates/productDescription.html @@ -5,17 +5,12 @@ + - +