r87467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87466‎ | r87467 | r87468 >
Date:23:04, 4 May 2011
Author:tparscal
Status:resolved (Comments)
Tags:
Comment:
Improved on r87466 - this is much simpler and more fair.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -640,9 +640,7 @@
641641 }
642642 if ( pitches.length ) {
643643 // Select randomly using equal distribution of available pitches
644 - var randomIndex = Math.round( Math.random() * Number.MAX_VALUE )
645 - % pitches.length;
646 - var key = pitches[randomIndex];
 644+ var key = pitches[Math.floor( Math.random() * list.length )];
647645 context.$ui.find( '.articleFeedback-pitches' )
648646 .css( 'width', context.$ui.width() )
649647 .find( '.articleFeedback-pitch[rel="' + key + '"]' )

Follow-up revisions

RevisionCommit summaryAuthorDate
r87562Added pending message to draw attention to the submit button when ratings are...tparscal18:55, 6 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87466Replaced random pitch selection math with something that doesn't penalize the...tparscal22:55, 4 May 2011

Comments

#Comment by Trevor Parscal (WMF) (talk | contribs)   19:03, 6 May 2011

This has an error in it - pitches is replaced by list, this is wrong. r87562 fixes this.

Status & tagging log