Index: trunk/extensions/CodeReview/backend/RepoStats.php |
— | — | @@ -13,7 +13,8 @@ |
14 | 14 | public $revisions, |
15 | 15 | $authors, |
16 | 16 | $states, |
17 | | - $fixmes; |
| 17 | + $fixmes, |
| 18 | + $new; |
18 | 19 | |
19 | 20 | /** |
20 | 21 | * @param CodeRepository $repo |
— | — | @@ -71,10 +72,22 @@ |
72 | 73 | $this->states[$row->cr_status] = $row->revs; |
73 | 74 | } |
74 | 75 | |
75 | | - $this->fixmes = array(); |
| 76 | + $this->fixmes = $this->getAuthorStatusCounts( 'fixme' ); |
| 77 | + $this->new = $this->getAuthorStatusCounts( 'new' ); |
| 78 | + |
| 79 | + wfProfileOut( __METHOD__ ); |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @param $status string |
| 84 | + * |
| 85 | + * @return array |
| 86 | + */ |
| 87 | + private function getAuthorStatusCounts( $status ) { |
| 88 | + $array = array(); |
76 | 89 | $res = $dbr->select( 'code_rev', |
77 | 90 | array( 'COUNT(*) AS revs', 'cr_author' ), |
78 | | - array( 'cr_repo_id' => $this->repo->getId(), 'cr_status' => 'fixme' ), |
| 91 | + array( 'cr_repo_id' => $this->repo->getId(), 'cr_status' => $status ), |
79 | 92 | __METHOD__, |
80 | 93 | array( |
81 | 94 | 'GROUP BY' => 'cr_author', |
— | — | @@ -83,9 +96,8 @@ |
84 | 97 | ) |
85 | 98 | ); |
86 | 99 | foreach ( $res as $row ) { |
87 | | - $this->fixmes[$row->cr_author] = $row->revs; |
| 100 | + $array[$row->cr_author] = $row->revs; |
88 | 101 | } |
89 | | - |
90 | | - wfProfileOut( __METHOD__ ); |
| 102 | + return $array; |
91 | 103 | } |
92 | 104 | } |
\ No newline at end of file |