Пример #1
0
 /**
  * Computes the number of revisions commited by each user
  *
  * @param int $startRevision First revision to work on
  * @param int $endRevision   Last revision to work on
  * @return array Computed data
  */
 protected function _computeRevisionsCountByAuthor($startRevision, $endRevision)
 {
     VcsStats_Runner_Cli::displayMessage('Calculating revisions count by author');
     $table = new VcsStats_Report_Element_Table();
     $table->setCode('revisions_count_by_author');
     $table->setTitle('Revisions count by author');
     $table->addColumn(new VcsStats_Report_Element_Table_Column('Author', 'author'));
     $table->addColumn(new VcsStats_Report_Element_Table_Column('Count', 'count', VcsStats_Report_Element_Table_Column::ALIGNMENT_RIGHT));
     $where = '';
     if (null !== $startRevision && null != $endRevision) {
         $where = "WHERE id >= {$startRevision} AND id <= {$endRevision}";
     }
     $sql = "SELECT author, COUNT(*) AS count\n                FROM revisions\n                {$where}\n                GROUP BY author\n                ORDER BY count DESC";
     $data = $this->_cache->fetchAll($sql);
     $table->setRows($data);
     return $table;
 }