Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.sql |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | -- Store mapping of i18n key of "rating" to an ID |
3 | 3 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment_ratings ( |
4 | | - aam_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
5 | | - aam_rating varchar(255) binary NOT NULL |
| 4 | + aar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 5 | + aar_rating varchar(255) binary NOT NULL |
6 | 6 | ) /*$wgDBTableOptions*/; |
7 | 7 | |
8 | 8 | -- INSERT INTO /*$wgDBprefix*/article_assessment_ratings(aam_rating) VALUES('articleassessment-rating-wellsourced'), |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php |
— | — | @@ -18,9 +18,9 @@ |
19 | 19 | $this->addTables( 'article_assessment_pages' ); |
20 | 20 | $this->addTables( 'article_assessment_ratings' ); |
21 | 21 | |
22 | | - $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aam_rating' ) ); |
| 22 | + $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aar_rating' ) ); |
23 | 23 | |
24 | | - $this->addWhereFld( 'aap_rating_id', 'aam_rating_id' ); |
| 24 | + $this->addWhere( 'aap_rating_id = aar_id' ); |
25 | 25 | |
26 | 26 | if ( isset( $params['pageid'] ) ) { |
27 | 27 | $this->addWhereFld( 'aap_page_id', $params['pageid'] ); |
— | — | @@ -37,15 +37,16 @@ |
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | | - $assessments[$row->aap_page_id]['ratings']['r' . $row->aap_rating] = array( |
| 41 | + $assessments[$row->aap_page_id]['ratings'][$row->aap_rating_id] = array( |
42 | 42 | 'ratingid' => $row->aap_rating_id, |
43 | | - 'ratingdesc' => $row->aam_rating, |
| 43 | + 'ratingdesc' => $row->aar_rating, |
44 | 44 | 'total' => $row->aap_total, |
45 | 45 | 'count' => $row->aap_count |
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | 49 | foreach ( $assessments as $ass ) { |
| 50 | + $result->setIndexedTagName( $ass['ratings'], 'r' ); |
50 | 51 | $result->addValue( array( 'query', $this->getModuleName() ), null, $ass ); |
51 | 52 | } |
52 | 53 | |