Index: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | $thisRating, $lastRating |
68 | 68 | ); |
69 | 69 | |
70 | | - $this->insertUserRatings( $pageId, $revisionId, $wgUser, $token, $rating, $thisRating ); |
| 70 | + $this->insertUserRatings( $pageId, $revisionId, $wgUser, $token, $rating, $thisRating, $params['bucket'] ); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $r = array( 'result' => 'Success' ); |
— | — | @@ -130,8 +130,9 @@ |
131 | 131 | * @param $token Array: Token if necessary |
132 | 132 | * @param $ratingId Integer: Rating Id |
133 | 133 | * @param $ratingValue Integer: Value of the Rating |
| 134 | + * @param $bucket Integer: Which rating widget was the user shown |
134 | 135 | */ |
135 | | - private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue ) { |
| 136 | + private function insertUserRatings( $pageId, $revisionId, $user, $token, $ratingId, $ratingValue, $bucket ) { |
136 | 137 | $dbw = wfGetDB( DB_MASTER ); |
137 | 138 | |
138 | 139 | $timestamp = $dbw->timestamp(); |
— | — | @@ -147,6 +148,7 @@ |
148 | 149 | 'aa_timestamp' => $timestamp, |
149 | 150 | 'aa_rating_id' => $ratingId, |
150 | 151 | 'aa_rating_value' => $ratingValue, |
| 152 | + 'aa_design_bucket' => $bucket |
151 | 153 | ), |
152 | 154 | $token |
153 | 155 | ), |
— | — | @@ -189,6 +191,12 @@ |
190 | 192 | ApiBase::PARAM_ISMULTI => false, |
191 | 193 | ), |
192 | 194 | 'anontoken' => null, |
| 195 | + 'bucket' => array( |
| 196 | + ApiBase::PARAM_TYPE => 'integer', |
| 197 | + ApiBase::PARAM_REQUIRED => true, |
| 198 | + ApiBase::PARAM_ISMULTI => false, |
| 199 | + ApiBase::PARAM_MIN => 1 |
| 200 | + ) |
193 | 201 | ); |
194 | 202 | |
195 | 203 | foreach( $wgArticleFeedbackRatings as $rating ) { |
— | — | @@ -209,6 +217,7 @@ |
210 | 218 | 'pageid' => 'Page ID to submit feedback for', |
211 | 219 | 'revid' => 'Revision ID to submit feedback for', |
212 | 220 | 'anontoken' => 'Token for anonymous users', |
| 221 | + 'bucket' => 'Which rating widget was shown to the user' |
213 | 222 | ); |
214 | 223 | foreach( $wgArticleFeedbackRatings as $rating ) { |
215 | 224 | $ret["r{$rating}"] = "Rating {$rating}"; |