Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php |
— | — | @@ -21,8 +21,10 @@ |
22 | 22 | $this->setHeaders(); |
23 | 23 | if ( $wgArticleFeedbackDashboard ) { |
24 | 24 | $this->renderDailyHighsAndLows(); |
| 25 | + /* |
| 26 | + This functionality does not exist yet. |
25 | 27 | $this->renderWeeklyMostChanged(); |
26 | | - $this->renderRecentLows(); |
| 28 | + $this->renderRecentLows();*/ |
27 | 29 | } else { |
28 | 30 | $wgOut->addWikiText( 'This page has been disabled.' ); |
29 | 31 | } |
— | — | @@ -195,6 +197,7 @@ |
196 | 198 | * This data should be updated daily, ideally though a scheduled batch job |
197 | 199 | */ |
198 | 200 | protected function getDailyHighsAndLows() { |
| 201 | + |
199 | 202 | return array( |
200 | 203 | array( |
201 | 204 | 'page' => 'Main Page', |
Index: trunk/extensions/ArticleFeedback/populateAFStatistics.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | * The period (in seconds) before now for which to gather stats |
19 | 19 | * @var int |
20 | 20 | */ |
21 | | - public $polling_period = 1000000;//86400; |
| 21 | + public $polling_period = 86400; |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * The formatted timestamp from which to determine stats |
— | — | @@ -86,11 +86,21 @@ |
87 | 87 | $highs_and_lows = array(); |
88 | 88 | $averages = array(); |
89 | 89 | foreach ( $ratings as $page_id => $data ) { |
| 90 | + $rating_count = 0; |
90 | 91 | foreach( $data as $rating_id => $rating ) { |
| 92 | + $rating_count += count( $rating ); |
91 | 93 | $rating_sum = array_sum( $rating ); |
92 | 94 | $rating_avg = $rating_sum / count( $rating ); |
93 | 95 | $highs_and_lows[ $page_id ][ 'avg_ratings' ][ $rating_id ] = $rating_avg; |
94 | 96 | } |
| 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 | + |
95 | 105 | $overall_rating_sum = array_sum( $highs_and_lows[ $page_id ][ 'avg_ratings' ] ); |
96 | 106 | $overall_rating_average = $overall_rating_sum / count( $highs_and_lows[ $page_id ][ 'avg_ratings' ] ); |
97 | 107 | $highs_and_lows[ $page_id ][ 'average' ] = $overall_rating_average; |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | */ |
13 | 13 | |
14 | 14 | /* XXX: Survey setup */ |
15 | | -require_once( $IP . '/extensions/SimpleSurvey/SimpleSurvey.php' ); |
| 15 | +require_once( dirname( dirname( __FILE__ ) ) . '/SimpleSurvey/SimpleSurvey.php' ); |
16 | 16 | |
17 | 17 | /* Configuration */ |
18 | 18 | |