Index: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js |
— | — | @@ -40,13 +40,15 @@ |
41 | 41 | |
42 | 42 | // recurse through the rates until we get into the range the user falls in, |
43 | 43 | // assign them to that range |
44 | | - var runningTotal = 0; |
| 44 | + var prev_val = -1; |
| 45 | + var next_val = 0; |
45 | 46 | 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){ |
48 | 49 | $.setBucket(campaign.name, rate, campaign.version); |
| 50 | + break; |
49 | 51 | } |
50 | | - break; |
| 52 | + prev_val = next_val; |
51 | 53 | } |
52 | 54 | } |
53 | 55 | |
Index: trunk/extensions/ClickTracking/modules/sampleCampaign.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | if(!MW.activeCampaigns){ MW.activeCampaigns ={}; } |
6 | 6 | |
7 | 7 | //define new active campaign |
8 | | -MW.activeCampaigns[MW.activeCampaigns.length] = |
| 8 | +MW.activeCampaigns.ArticleSave = |
9 | 9 | |
10 | 10 | { |
11 | 11 | //Treatment name |