blob: 76e3cf224968fbcdf831516ac190629d1858212e [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_ip_cq_intake_q(ChartContext $context) {
return ChartBuilder::named ( 'ip_cq_intake_q' )
->title ( "CQ Creation By Quarter (:start to :end)" )
->description ( "The number of CQs created each quarter by type." )
->query ('ipzilla', "
select
concat(year(b.creation_ts),'-',quarter(b.creation_ts)) as period,
sum(if(kd.name='projectcode', 1, 0)) as projectcode,
sum(if(kd.name='thirdparty',if(b.cf_type='Type_A',1,0),0)) as typeA,
sum(if(kd.name='thirdparty',if(b.cf_type='Type_B',1,0),0)) as typeB
from bugs as b
join components as c on b.component_id=c.id
join keywords as k on b.bug_id=k.bug_id
join keyworddefs as kd on k.keywordid=kd.id
and kd.name in ('projectcode','thirdparty')
where
b.short_desc not regexp '\((Orbit|PB( Orbit)?|ATO)\s*\d*\)'
and c.name not in ('IP_Discussion')
and b.creation_ts between date(':start') and date(':end')
group by concat(year(b.creation_ts),'-',quarter(b.creation_ts))
" )
->substitute ( ':start', $context->getStart()->format('Y-m-d') )
->substitute ( ':end', $context->getEnd()->format('Y-m-d') )
->column ( 'Month', 'period', 'string')
->column ( 'Project Code', 'projectcode', 'number' )
->column ( 'Type A', 'typeA', 'number' )
->column ( 'Type B', 'typeB', 'number' );
}
?>