blob: ec6b6fb8bbe9f814cb6afd2f233c8314a53e824b [file] [log] [blame]
<?php
/********************************************************************************
* Copyright (c) 2016 The Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
require_once dirname ( __FILE__ ) . '/charts.inc';
require_once dirname ( __FILE__ ) . '/../classes/database.inc';
function renderQuarterlyTop10ContributorsChart() {
// TODO Use the ChartBuilder API.
global $App;
list ( $quarter, $start, $end ) = getLastQuarter ( time () );
$sql = "
select
project, Authors-Committers as count
from ProjectQuarterlySummary
where quarter='$quarter'
and Authors-Committers >= (
select Authors-Committers as count
from ProjectQuarterlySummary
where quarter='$quarter'
order by count desc limit 10, 1)
order by count desc";
$rows = array ();
query ( 'dashboard', $sql, array (), function ($row) use (&$rows) {
$project = Project::getProject ( $row ['project'] );
$count = $row ['count'];
$rows [] = array (
$project ? $project->getNickName () : $row ['project'],
$count
);
} );
echo "<p>Based on commits between $start and $end.</p>";
$columns = array (
array (
'label' => 'Project',
'type' => 'string'
),
array (
'label' => 'Commits',
'type' => 'number'
)
);
drawPieChart ( 'Top10ContributorsQuarterly', "Top \"Ten\" Projects by Contributor Count ($quarter)", $columns, $rows );
}
function renderLicensesInUseChart() {
// TODO Use the ChartBuilder API.
global $App;
$now = date ( 'Y-m' );
$sql = "
SELECT
license, count(project) as count
from (
SELECT
p.ProjectId as project,
group_concat(
if(LicenseId='EPL1.0','EPL-1.0',
if(LicenseId='EPL2.0','EPL-2.0',
if(LicenseId='EDL1.0','EDL-1.0',
if(LicenseId='ASL2.0','Apache-2.0',
if(LicenseId='CCBY3','CC-BY-3.0',
LicenseId)))))
ORDER BY LicenseId separator ' OR ') as license
FROM ProjectLicenses as pl
JOIN Projects as p on pl.ProjectId=p.ProjectId
AND p.IsActive group by p.ProjectId
) as ProjectsAndLicenses
group by license
order by count desc";
$rows = array ();
query ( 'foundation', $sql, array (), function ($row) use (&$rows) {
$rows [] = array (
$row ['license'],
$row ['count']
);
} );
$columns = array (
array (
'label' => 'License',
'type' => 'string'
),
array (
'label' => 'Count',
'type' => 'number'
)
);
drawPieChart ( 'LicenseUse', "Licenses in use by Eclipse Projects on $now", $columns, $rows );
}
?>