r87384 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87383‎ | r87384 | r87385 >
Date:02:10, 4 May 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Unpatched local version of ArticleFeedback to replace original require_once path for usability-related stuff; Replaced default polling period to be 24 hours; Added in functionality to ensure that only ratings with 10+ ratings in a given polling period get counted for high/low stats gathering; Commented out method calls currently not needed in special page for article feedback;
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/populateAFStatistics.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php
@@ -21,8 +21,10 @@
2222 $this->setHeaders();
2323 if ( $wgArticleFeedbackDashboard ) {
2424 $this->renderDailyHighsAndLows();
 25+ /*
 26+ This functionality does not exist yet.
2527 $this->renderWeeklyMostChanged();
26 - $this->renderRecentLows();
 28+ $this->renderRecentLows();*/
2729 } else {
2830 $wgOut->addWikiText( 'This page has been disabled.' );
2931 }
@@ -195,6 +197,7 @@
196198 * This data should be updated daily, ideally though a scheduled batch job
197199 */
198200 protected function getDailyHighsAndLows() {
 201+
199202 return array(
200203 array(
201204 'page' => 'Main Page',
Index: trunk/extensions/ArticleFeedback/populateAFStatistics.php
@@ -17,7 +17,7 @@
1818 * The period (in seconds) before now for which to gather stats
1919 * @var int
2020 */
21 - public $polling_period = 1000000;//86400;
 21+ public $polling_period = 86400;
2222
2323 /**
2424 * The formatted timestamp from which to determine stats
@@ -86,11 +86,21 @@
8787 $highs_and_lows = array();
8888 $averages = array();
8989 foreach ( $ratings as $page_id => $data ) {
 90+ $rating_count = 0;
9091 foreach( $data as $rating_id => $rating ) {
 92+ $rating_count += count( $rating );
9193 $rating_sum = array_sum( $rating );
9294 $rating_avg = $rating_sum / count( $rating );
9395 $highs_and_lows[ $page_id ][ 'avg_ratings' ][ $rating_id ] = $rating_avg;
9496 }
 97+
 98+ // make sure that we have at least 10 ratings for this page
 99+ if ( $rating_count < 10 ) {
 100+ // if not, remove it from our data store
 101+ unset( $highs_and_lows[ $page_id ] );
 102+ continue;
 103+ }
 104+
95105 $overall_rating_sum = array_sum( $highs_and_lows[ $page_id ][ 'avg_ratings' ] );
96106 $overall_rating_average = $overall_rating_sum / count( $highs_and_lows[ $page_id ][ 'avg_ratings' ] );
97107 $highs_and_lows[ $page_id ][ 'average' ] = $overall_rating_average;
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php
@@ -11,7 +11,7 @@
1212 */
1313
1414 /* XXX: Survey setup */
15 -require_once( $IP . '/extensions/SimpleSurvey/SimpleSurvey.php' );
 15+require_once( dirname( dirname( __FILE__ ) ) . '/SimpleSurvey/SimpleSurvey.php' );
1616
1717 /* Configuration */
1818

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87381Now actually determing only the top and bottom 50 rated pagesawjrichards01:51, 4 May 2011

Status & tagging log