Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php |
— | — | @@ -49,6 +49,9 @@ |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
| 53 | + $limit = $params['limit'] * 4; //4 "Ratings" |
| 54 | + $this->addOption( 'LIMIT', $limit ); |
| 55 | + |
53 | 56 | $res = $this->select( __METHOD__ ); |
54 | 57 | |
55 | 58 | $ratings = array(); |
— | — | @@ -82,7 +85,13 @@ |
83 | 86 | $ratings[$pageId]['ratings'][] = $thisRow; |
84 | 87 | } |
85 | 88 | |
| 89 | + $count = 0; |
86 | 90 | foreach ( $ratings as $rat ) { |
| 91 | + if ( ++ $count > $limit ) { |
| 92 | + //$this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->page_title ) ); |
| 93 | + break; |
| 94 | + } |
| 95 | + |
87 | 96 | $result->setIndexedTagName( $rat['ratings'], 'r' ); |
88 | 97 | $result->addValue( array( 'query', $this->getModuleName() ), null, $rat ); |
89 | 98 | } |
— | — | @@ -95,6 +104,13 @@ |
96 | 105 | 'pageid' => null, |
97 | 106 | 'revid' => null, |
98 | 107 | 'userrating' => false, |
| 108 | + 'limit' => array( |
| 109 | + ApiBase::PARAM_DFLT => 1, |
| 110 | + ApiBase::PARAM_TYPE => 'limit', |
| 111 | + ApiBase::PARAM_MIN => 1, |
| 112 | + ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, |
| 113 | + ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 |
| 114 | + ), |
99 | 115 | ); |
100 | 116 | } |
101 | 117 | |
— | — | @@ -103,6 +119,7 @@ |
104 | 120 | 'pageid' => 'Page ID to get assessments for', |
105 | 121 | 'revid' => 'Specific revision to get (used in conjunction with user param, otherwise ignored)', |
106 | 122 | 'userrating' => 'Whether to get the current users ratings for the specific rev/article', |
| 123 | + 'limit' => 'Amount of pages to get the ratings for', |
107 | 124 | ); |
108 | 125 | } |
109 | 126 | |