View Issue Details

IDProjectCategoryView StatusLast Update
0005336mantisbtbugtrackerpublic2005-09-11 08:12
Reporterstb Assigned Tothraxisp  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionfixed 
PlatformLinux 
Product Version0.19.2 
Fixed in Version1.0.0rc2 
Summary0005336: Summary does not combine categories
Description

I have two different projects with same categories. In summary view (all projects) I see one line for each category and project ("by categories"). This lines should be combined. The links are the same, too.

Steps To Reproduce

create two projects "p1" and "p2", each having the category "cat_a". Enter a bug for each project in cat_a. Display summary.

Additional Information

Termine 1 0 0 1
Sonstiges 6 0 0 6
Termine 1 0 0 1
Aufgaben 3 0 0 3
Kontakte 3 0 0 3
Sonstiges 3 0 0 3
Termine 2 0 0 2

This is an excerpt from my summary view ("by categories"). You can see 3 projects, each having 1 or 2 entries for category "Termine". The http-link behind those numbers are equal (which is correct, IMHO). The lines should be combined:

Termine 4 0 0 4
Sonstiges 9 0 0 9
Aufgaben 3 0 0 3
Kontakte 3 0 0 3

TagsNo tags attached.
Attached Files
summary_api.categories.php.txt (2,342 bytes)   
function summary_helper_count_bugs( $query_part ) {
	$resolved_result = db_query( $query_part .' AND status='. RESOLVED );
	$resolved_arr = db_fetch_array( $resolved_result );
	list(, $resolved) = each( $resolved_arr );
	
	$closed_result = db_query( $query_part .' AND status='. CLOSED );
	$closed_arr = db_fetch_array( $closed_result );
	list(, $closed) = each( $closed_arr );
	
	$total_result = db_query( $query_part );
	$total_arr = db_fetch_array( $total_result );
	list(, $total) = each( $total_arr );
	
	return Array( 'open' => $total - $closed - $resolved,
		'resolved' => $resolved,
		'closed' => $closed,
		'total' => $total); 
}

# --------------------
# print a bug count per category
function summary_print_by_category() {
	$t_mantis_bug_table = config_get( 'mantis_bug_table' );
	$t_mantis_project_table = config_get( 'mantis_project_table' );
	$t_mantis_project_category_table = config_get( 'mantis_project_category_table' );
	$t_summary_category_include_project = config_get( 'summary_category_include_project' );
	
	$t_project_id = helper_get_current_project();
	$t_user_id = auth_get_current_user_id();
	
	$specific_where = helper_project_specific_where( $t_project_id );
	if ( ' 1<>1' == $specific_where ) {
		return;
	}
	
	# Sum up the bugs in each category
	$query = "SELECT DISTINCT category
		FROM $t_mantis_project_category_table
		WHERE $specific_where
		ORDER BY category";
	$category_result = db_query( $query );
	# Start with empty category
	$category_row = array( "category" => "" );
	do {
		extract( $category_row, EXTR_PREFIX_ALL, 'v' );
		$query_part = "SELECT COUNT(id)
			FROM $t_mantis_bug_table
			WHERE $specific_where
			AND category='". db_prepare_string( $v_category )."'";
		$bugs = summary_helper_count_bugs( $query_part );
		$t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&amp;show_category=' . $v_category;
		summary_helper_print_row( $v_category,
			$t_bug_link. '&amp;hide_status=' .RESOLVED. '">' .$bugs['open']. '</a>',
			$t_bug_link. '&amp;show_status=' .RESOLVED. '&amp;hide_status=' .CLOSED. '">' .$bugs['resolved']. '</a>',
			$t_bug_link. '&amp;show_status=' .CLOSED. '&amp;hide_status=">' .$bugs['closed']. '</a>',
			$t_bug_link. '&amp;hide_status=">' .$bugs['total']. '</a>' );
	} while ( $category_row = db_fetch_array( $category_result ) );
}
summary_api.categories.php.txt (2,342 bytes)   

Relationships

has duplicate 0005663 closedthraxisp Summary-Page displays "by caterory" Project-wise 

Activities

thraxisp

thraxisp

2005-03-13 18:58

reporter   ~0009526

The configuration $g_summary_category_include_project will add the project name to the category.

If the categories are really related to the same piece of work/code, you may want to look into the new sub=project feature in 1.0.0. The code is in CVs now.

We can add a config variable to control this. Some people want to see, say, documentation for project a separated from documentation for project b.

stb

stb

2005-03-18 08:57

reporter   ~0009586

Suggestion: combine categories in summary when
$g_summary_category_include_project = OFF

Why not combine categories in summary of that option is disabled (this is I expected)? I think Mantis should combine categories every time the user cannot distinguish them (project name missing). Please note, that the links are equal (getting me to all bugs of the given category), so the information displayed in the link line should be correlated to the link (sum of all bugs of this category over all projects).

Sjord

Sjord

2005-06-14 10:15

reporter   ~0010512

To solve this, modify the query in core/summary_api.php:summary_print_by_category(). Remove project_id from the query.

Sjord

Sjord

2005-07-12 04:56

reporter   ~0010728

I have made a new summary_print_by_category() function which combines the categories and is faster when there are not that many categories.

thraxisp

thraxisp

2005-08-15 15:25

reporter   ~0011214

Fixed in CVS.

core/summary_api.php -> 1.41