blob: 9fe8821b37c92e63a822bbdcbcd90dea5016bee3 [file] [log] [blame]
<?php
/********************************************************************************
* Copyright (c) 2018 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';
function chart_cc_projects(ChartContext $context) {
return ChartBuilder::named ( 'cc_projects' )
->title ( "Committers by Country (:date)" )
->description ( "All project committers by country." )
->pieChart()
->query ('foundation', "
SELECT
lower(pa.CCode) as code,
if(pa.CCode is null, 'Unspecified', c.en_Description) as country,
count(distinct pp.PersonId) as count
FROM PeopleProjects as pp
left join PeopleAddresses as pa on pp.PersonID=pa.PersonID
left join SYS_Countries as c on pa.CCode=c.CCode
where pp.InactiveDate is null
and pp.Relation='CM'
group by country
order by if(code is null, 1, 0) asc, count desc
" )
->substitute ( ':date', (new DateTime())->format('Y-m-d') )
->column ( 'Country', 'country', 'string')
->column ( 'Count', 'count', 'number' );
}
?>