r86158 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86157‎ | r86158 | r86159 >
Date:23:57, 15 April 2011
Author:nimishg
Status:ok
Tags:
Comment:
bugfixes to the way samplecampaign and userbuckets calculate values
Modified paths:
  • /trunk/extensions/ClickTracking/modules/ext.UserBuckets.js (modified) (history)
  • /trunk/extensions/ClickTracking/modules/sampleCampaign.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js
@@ -40,13 +40,15 @@
4141
4242 // recurse through the rates until we get into the range the user falls in,
4343 // assign them to that range
44 - var runningTotal = 0;
 44+ var prev_val = -1;
 45+ var next_val = 0;
4546 for( rate in campaign.rates ){
46 - runningTotal += campaign.rates[rate];
47 - if(currentUser <= runningTotal){
 47+ next_val += campaign.rates[rate];
 48+ if(prev_val <= currentUser && currentUser < next_val){
4849 $.setBucket(campaign.name, rate, campaign.version);
 50+ break;
4951 }
50 - break;
 52+ prev_val = next_val;
5153 }
5254 }
5355
Index: trunk/extensions/ClickTracking/modules/sampleCampaign.js
@@ -4,7 +4,7 @@
55 if(!MW.activeCampaigns){ MW.activeCampaigns ={}; }
66
77 //define new active campaign
8 -MW.activeCampaigns[MW.activeCampaigns.length] =
 8+MW.activeCampaigns.ArticleSave =
99
1010 {
1111 //Treatment name

Status & tagging log