Skip to content

Commit

Permalink
MantisGraph: incorrect issues count in graph by severity
Browse files Browse the repository at this point in the history
When $g_bug_closed_status_threshold is not the "final" entry in
status_enum_string list, function enum_bug_group() in graph_api.php
computed the number of closed issues incorrectly due to use of '='
operator instead of '>=' in the query's where clause.

Also corrects some trailing whitespace.

Fixes #14356
  • Loading branch information
dregad committed Jun 15, 2012
1 parent 07cb1b5 commit b63e181
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions plugins/MantisGraph/core/graph_api.php
Expand Up @@ -22,7 +22,7 @@
* @link http://www.mantisbt.org
*/


if( OFF == plugin_config_get( 'eczlibrary' ) ) {
$t_font_path = get_font_path();
if( $t_font_path !== '' && !defined('TTF_DIR') ) {
Expand Down Expand Up @@ -117,7 +117,7 @@ function graph_bar( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_he
$graph->options->font = $t_graph_font ;
$graph->options->font->maxFontSize = 12;
$graph->legend = false;

$graph->data[0] = new ezcGraphArrayDataSet( $p_metrics );
$graph->data[0]->color = '#FFFF00';

Expand All @@ -128,9 +128,9 @@ function graph_bar( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_he
//$graph->driver->options->supersampling = 1;
$graph->driver->options->jpegQuality = 100;
$graph->driver->options->imageFormat = IMG_JPEG;

$graph->renderer->options->syncAxisFonts = false;

$graph->renderToOutput( $p_graph_width, $p_graph_height);
} else {
$graph = new Graph( $p_graph_width, $p_graph_height );
Expand Down Expand Up @@ -200,7 +200,7 @@ function graph_group( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_
$graph->options->font = $t_graph_font ;
$graph->options->font->maxFontSize = 12;
$graph->legend = false;

foreach( array( 'open', 'resolved', 'closed' ) as $t_label ) {
$graph->data[$t_label] = new ezcGraphArrayDataSet( $p_metrics[$t_label] );
}
Expand All @@ -215,9 +215,9 @@ function graph_group( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_
//$graph->driver->options->supersampling = 1;
$graph->driver->options->jpegQuality = 100;
$graph->driver->options->imageFormat = IMG_JPEG;

$graph->renderer->options->syncAxisFonts = false;

$graph->renderToOutput( $p_graph_width, $p_graph_height);
} else {
# defines margin according to height
Expand Down Expand Up @@ -293,7 +293,7 @@ function graph_pie( $p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_he
$graph->options->font = $t_graph_font ;
$graph->options->font->maxFontSize = 12;
$graph->legend = false;

$graph->data[0] = new ezcGraphArrayDataSet( $p_metrics );
$graph->data[0]->color = '#FFFF00';

Expand All @@ -308,9 +308,9 @@ function graph_pie( $p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_he
//$graph->driver->options->supersampling = 1;
$graph->driver->options->jpegQuality = 100;
$graph->driver->options->imageFormat = IMG_JPEG;

$graph->renderer->options->syncAxisFonts = false;

$graph->renderToOutput( $p_graph_width, $p_graph_height);
} else {
$graph = new PieGraph( $p_graph_width, $p_graph_height );
Expand Down Expand Up @@ -358,7 +358,7 @@ function graph_cumulative_bydate( $p_metrics, $p_graph_width = 300, $p_graph_hei
$graph = new ezcGraphLineChart();

$graph->background->color = '#FFFFFF';

$graph->xAxis = new ezcGraphChartElementNumericAxis();

$graph->data[0] = new ezcGraphArrayDataSet( $p_metrics[0] );
Expand Down Expand Up @@ -396,7 +396,7 @@ function graph_cumulative_bydate( $p_metrics, $p_graph_width = 300, $p_graph_hei
$graph->options->font = $t_graph_font ;

$graph->renderToOutput( $p_graph_width, $p_graph_height);
} else {
} else {
foreach( $p_metrics[0] as $i => $vals ) {
if( $i > 0 ) {
$plot_date[] = $i;
Expand Down Expand Up @@ -475,15 +475,15 @@ function graph_bydate( $p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p
$t_cnt = count($p_metrics);

foreach( $t_dates as $i => $val ) {
//$t_metrics[$val]
//$t_metrics[$val]
for($j = 0; $j < $t_cnt; $j++ ) {
$t_metrics[$j][$val] = $p_metrics[$j][$i];
}
}

$graph = new ezcGraphLineChart();
$graph->background->color = '#FFFFFF';

$graph->xAxis = new ezcGraphChartElementNumericAxis();
for($k = 0; $k < $t_cnt; $k++ ) {
$graph->data[$k] = new ezcGraphArrayDataSet( $t_metrics[$k] );
Expand All @@ -508,7 +508,7 @@ function graph_bydate( $p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p
$graph->options->font = $t_graph_font ;

$graph->renderToOutput( $p_graph_width, $p_graph_height);
} else {
} else {
$graph = new Graph( $p_graph_width, $p_graph_height );
$graph->img->SetMargin( 40, 140, 40, 100 );
if( ON == plugin_config_get( 'jpgraph_antialias' ) ) {
Expand Down Expand Up @@ -620,7 +620,7 @@ function enum_bug_group( $p_enum_string, $p_enum ) {
$query = "SELECT COUNT(*)
FROM $t_bug_table
WHERE $p_enum='$t_value' AND
status='$t_clo_val' $specific_where";
status>='$t_clo_val' $specific_where";
$result2 = db_query( $query );
$t_metrics['closed'][$t_label] = db_result( $result2, 0, 0 );

Expand Down Expand Up @@ -890,11 +890,11 @@ function error_check( $bug_count, $title ) {
}
}

function error_text( $title, $text ) {
function error_text( $title, $text ) {
if( OFF == plugin_config_get( 'eczlibrary' ) ) {

$t_graph_font = graph_get_font();

$graph = new CanvasGraph( 300, 380 );

$txt = new Text( $text, 150, 100 );
Expand Down

0 comments on commit b63e181

Please sign in to comment.