Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php |
— | — | @@ -45,8 +45,8 @@ |
46 | 46 | $info[$row->field_name] = array( |
47 | 47 | 'ratingdesc' => $row->field_name, |
48 | 48 | 'ratingid' => (int) $row->field_id, |
49 | | - 'total' => (int) $row->points, |
50 | | - 'count' => (int) $row->reviews, |
| 49 | + 'total' => (int) $row->arr_total, |
| 50 | + 'count' => (int) $row->add_count, |
51 | 51 | ); |
52 | 52 | } |
53 | 53 | $result->addValue( $result_path, 'rollup', $info ); |
— | — | @@ -58,28 +58,26 @@ |
59 | 59 | * @param $pageId int the page id |
60 | 60 | * @param $revisionLimit int go back only to this revision |
61 | 61 | * @param $type string the type of row to fetch ('page' or 'revision') |
62 | | - * @return array the rollup row |
| 62 | + * @return array the rollup rows |
63 | 63 | */ |
64 | 64 | private function fetchRollup( $pageId, $revisionLimit, $type ) { |
65 | 65 | $dbr = wfGetDB( DB_SLAVE ); |
66 | 66 | $where = array(); |
67 | 67 | $table = 'article_feedback_ratings_rollup'; |
68 | | - $prefix = 'arr'; |
69 | | - $where[$prefix . '_page_id'] = $pageId; |
70 | | - $where[] = $prefix . '_rating_id = afi_id'; |
| 68 | + $where['arr_page_id'] = $pageId; |
| 69 | + $where[] = 'arr_rating_id = afi_id'; |
71 | 70 | $rows = $dbr->select( |
72 | | - array( 'aft_' . $table, 'aft_article_field' ), |
| 71 | + array( |
| 72 | + 'aft_article_feedback_ratings_rollup', |
| 73 | + 'aft_article_field' ), |
73 | 74 | array( |
74 | 75 | 'afi_name AS field_name', |
75 | | - $prefix . '_rating_id AS field_id', |
76 | | - 'SUM(' . $prefix . '_total) AS points', |
77 | | - 'SUM(' . $prefix . '_count) AS reviews', |
| 76 | + 'arr_rating_id AS field_id', |
| 77 | + 'arr_total', |
| 78 | + 'arr_count', |
78 | 79 | ), |
79 | 80 | $where, |
80 | 81 | __METHOD__, |
81 | | - array( |
82 | | - 'GROUP BY' => $prefix . '_rating_id, afi_name' |
83 | | - ) |
84 | 82 | ); |
85 | 83 | |
86 | 84 | return $rows; |
— | — | @@ -94,7 +92,6 @@ |
95 | 93 | return array( |
96 | 94 | 'pageid' => array( |
97 | 95 | ApiBase::PARAM_REQUIRED => true, |
98 | | - ApiBase::PARAM_ISMULTI => false, |
99 | 96 | ApiBase::PARAM_TYPE => 'integer', |
100 | 97 | ) |
101 | 98 | ); |