r72054 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72053‎ | r72054 | r72055 >
Date:21:49, 31 August 2010
Author:reedy
Status:deferred
Tags:
Comment:
Need newest revision id
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php
@@ -49,6 +49,8 @@
5050 }
5151 }
5252
 53+ $this->addOption( 'ORDER BY', 'aa_revision DESC' );
 54+
5355 $limit = $params['limit'];
5456 $this->addOption( 'LIMIT', $limit * 4 ); //4 "Ratings"
5557
@@ -66,8 +68,8 @@
6769 'pageid' => $pageId,
6870 );
6971
70 - if ( isset( $params['revid'] ) ){
71 - $page['revid'] = $row->aa_revision ;
 72+ if ( isset( $params['revid'] ) || $params['userrating'] ){
 73+ $page['revid'] = $row->aa_revision;
7274 }
7375
7476 $ratings[$pageId] = $page;
@@ -90,15 +92,16 @@
9193 }
9294
9395 //Only can actually be "stale" if the user has rated the article before
94 - //We need a target revision to be able to calculate "stale" against
95 - if ( $params['userrating'] && $userRatedArticle && $params['revid'] ) {
 96+ if ( $params['userrating'] && $userRatedArticle ) {
 97+ $revid = isset( $params['revid'] ) ? $params['revid'] : $ratings[$pageId]['revid'];
 98+
9699 $this->resetQueryParams();
97100
98101 $this->addTables( 'revision' );
99102 $this->addFields( array( 'COUNT(rev_id) AS norevs', 'rev_page' ) );
100103
101104 $this->addWhereFld( 'rev_page', $params['pageid'] );
102 - $this->addWhere( 'rev_id > ' . $params['revid'] );
 105+ $this->addWhere( 'rev_id > ' . $revid );
103106
104107 $res = $this->select( __METHOD__ );
105108

Status & tagging log