EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/285542

Change subject: Revert "Test to measure clickthrough position after swapping 
results"
......................................................................

Revert "Test to measure clickthrough position after swapping results"

This test has completed and is no longer necessary.
This reverts commit 5e5bfc25cc78e3eff295e81db01f7093696ce33b.

Change-Id: I336daddf6bede81dc1867df631a338cc76f37fcd
(cherry picked from commit fd63a8fcd69f5ed0542eddcb227b430563e3c11f)
---
M modules/ext.wikimediaEvents.searchSatisfaction.js
1 file changed, 22 insertions(+), 52 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/42/285542/1

diff --git a/modules/ext.wikimediaEvents.searchSatisfaction.js 
b/modules/ext.wikimediaEvents.searchSatisfaction.js
index e2c0d45..11e9980 100644
--- a/modules/ext.wikimediaEvents.searchSatisfaction.js
+++ b/modules/ext.wikimediaEvents.searchSatisfaction.js
@@ -25,7 +25,7 @@
                return;
        }
 
-       var search, autoComplete, session, eventLog, initSubTest,
+       var search, autoComplete, session, eventLog,
                isSearchResultPage = mw.config.get( 'wgIsSearchResultPage' ),
                uri = new mw.Uri( location.href ),
                checkinTimes = [ 10, 20, 30, 40, 50, 60, 90, 120, 150, 180, 
210, 240, 300, 360, 420 ],
@@ -67,7 +67,6 @@
                // persistent state keys that have a lifetime
                        ttl = {
                                sessionId: 10 * 60 * 1000,
-                               subTest: 10 * 60 * 1000,
                                token: 24 * 60 * 60 * 1000
                        },
                        now = new Date().getTime();
@@ -121,7 +120,7 @@
                        }
                        // If a sessionId exists the user was previously 
accepted into the test
                        if ( !sessionId ) {
-                               if ( !oneIn( 100 ) ) {
+                               if ( !oneIn( 200 ) ) {
                                        // user was not chosen in a sampling of 
search results
                                        session.set( 'sessionId', 'rejected' );
                                        return false;
@@ -130,11 +129,6 @@
                                // have a search session id, generate one.
                                if ( !session.set( 'sessionId', randomToken() ) 
) {
                                        return false;
-                               }
-
-                               // Assign 50% of users to test bucket
-                               if ( oneIn( 2 ) ) {
-                                       session.set( 'subTest', 'swap2and3' );
                                }
                        }
 
@@ -365,10 +359,6 @@
 
                        lastScrollTop = scrollTop;
 
-                       if ( session.get( 'subTest' ) ) {
-                               evt.subTest = session.get( 'subTest' );
-                       }
-
                        if ( articleId > 0 ) {
                                evt.articleId = articleId;
                        }
@@ -483,32 +473,6 @@
        }
 
        /**
-        * Decorator to call the inner function at most one time.
-        *
-        * @param {Function} fn
-        * @return {Function}
-        */
-       function atMostOnce( fn ) {
-               var called = false;
-               return function () {
-                       if ( !called ) {
-                               fn.apply( null, arguments );
-                               called = true;
-                       }
-               };
-       }
-
-       initSubTest = atMostOnce( function ( session ) {
-               if ( session.get( 'subTest' ) === 'swap2and3' ) {
-                       $( '<input>' ).attr( {
-                               type: 'hidden',
-                               name: 'cirrusSRTest',
-                               value: 'yes'
-                       } ).insertAfter( $( 'input[type=search]' ) );
-               }
-       } );
-
-       /**
         * Delay session initialization as late in the
         * process as possible, but only do it once.
         *
@@ -519,8 +483,23 @@
 
                if ( session.get( 'enabled' ) ) {
                        fn( session );
-                       initSubTest( session );
                }
+       }
+
+       /**
+        * Decorator to call the inner function at most one time.
+        *
+        * @param {Function} fn
+        * @return {Function}
+        */
+       function atMostOnce( fn ) {
+               var called = false;
+               return function () {
+                       if ( !called ) {
+                               fn();
+                               called = true;
+                       }
+               };
        }
 
        // Full text search satisfaction tracking
@@ -532,28 +511,19 @@
 
        // Autocomplete satisfaction tracking
        $( document ).ready( function () {
-               var initialize = atMostOnce( function () {
-                       setup( setupAutocompleteTest );
-               } );
                if ( autoComplete.cameFromSearch ) {
                        // user came here by selecting an autocomplete result,
                        // initialize on page load
-                       initialize();
+                       setup( setupAutocompleteTest );
                } else {
                        // delay initialization until the user clicks into the 
autocomplete
                        // box. Note there are two elements matching this 
selector, the
                        // main search box on Special:Search and the search box 
on every
                        // page. $.one fires once per element and not once 
ever, hence the
                        // decorator.
-                       //
-                       // This has to subscribe to multiple events to ensure 
it captures
-                       // in modern  browsers (input) and less modern browsers 
(the rest).
-                       // The atMostOne() makes sure we only truly initialize 
once.
-                       $( 'input[type=search]' )
-                               .one( 'input', initialize )
-                               .one( 'change', initialize )
-                               .one( 'paste', initialize )
-                               .one( 'keypress', initialize );
+                       $( 'input[type=search]' ).one( 'focus', atMostOnce( 
function () {
+                               setup( setupAutocompleteTest );
+                       } ) );
                }
        } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/285542
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I336daddf6bede81dc1867df631a338cc76f37fcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: wmf/1.27.0-wmf.21
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to