View Issue Details

IDProjectCategoryView StatusLast Update
0005684mantisbtotherpublic2005-09-11 08:10
ReporterRJelinek Assigned Tothraxisp  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.0a2 
Fixed in Version1.0.0rc2 
Summary0005684: Summary over projects evaluates wrong results
Description

If I use the summary-menu, I get a statistic about all bugs per project splitted into closed / solved and opened. The opened-field should summarize about all entries which are not closed or solved, but it does not. It only shows me the number of entries beeing in the status with the highest status-enumeration-value.

Additional Information

In summary_print_by_project after the SQL-request the values are divided into an array called $p_cache[$v_project_id][...]. In the default-case of the switch the values should be summarized.

It also happens in 1.0.0a3 (version was not available yet)

TagsNo tags attached.
Attached Files
summary_print_by_project.txt (2,218 bytes)   
	function summary_print_by_project( $p_projects = null, $p_level = 0, $p_cache = null ) {
		$t_mantis_bug_table 	= config_get( 'mantis_bug_table' );
		$t_mantis_project_table = config_get( 'mantis_project_table' );

		$t_project_id = helper_get_current_project();

		if ( null == $p_projects ) {
			if ( ALL_PROJECTS == $t_project_id ) {
				$p_projects = current_user_get_accessible_projects();
			} else {
				$p_projects = Array( $t_project_id );
			}
		}

		# Retrieve statistics one time to improve performance.
		if ( null === $p_cache ) {
			$query = "SELECT project_id, status, COUNT( status ) AS count
					FROM $t_mantis_bug_table
					GROUP BY project_id, status";

			$result = db_query( $query );
			$p_cache = Array();

			$t_resolved_val = RESOLVED;
			$t_closed_val = CLOSED;
			
			$p_cache[ $v_project_id ][ 'open'     ]  = 0;

			while ( $row = db_fetch_array( $result ) ) {
				extract( $row, EXTR_PREFIX_ALL, 'v' );

				switch( $v_status ) {
					case $t_resolved_val:
										$p_cache[ $v_project_id ][ 'resolved' ]  = $v_count;
										break;
					case $t_closed_val:
										$p_cache[ $v_project_id ][ 'closed'   ]  = $v_count;
										break;
					default:
										$p_cache[ $v_project_id ][ 'open'     ]  += $v_count;
										break;
				}
			}
		}

		foreach ( $p_projects as $t_project ) {
			$t_name = str_repeat( "� ", $p_level ) . project_get_name( $t_project );

			$t_pdata = isset( $p_cache[ $t_project ] ) ? $p_cache[ $t_project ]
			             : array( 'open' => 0, 'resolved' => 0, 'closed' => 0 );

			$t_bugs_open     = isset( $t_pdata['open'] ) ? $t_pdata['open'] : 0;
			$t_bugs_resolved = isset( $t_pdata['resolved'] ) ? $t_pdata['resolved'] : 0;
			$t_bugs_closed   = isset( $t_pdata['closed'] ) ? $t_pdata['closed'] : 0;
			$t_bugs_total    = $t_bugs_open + $t_bugs_resolved + $t_bugs_closed;

			summary_helper_print_row( $t_name, $t_bugs_open, $t_bugs_resolved, $t_bugs_closed, $t_bugs_total );

			$t_subprojects = current_user_get_accessible_subprojects( $t_project );

			if ( count( $t_subprojects ) > 0 ) {
				summary_print_by_project( $t_subprojects, $p_level + 1, $p_cache );
			}
		}
	}
summary_print_by_project.txt (2,218 bytes)   

Activities

dskiles

dskiles

2005-08-19 13:22

reporter   ~0011242

I've patched this problem by adding two lines to summary_print_by_project() in summary_api.php.

The problem was that there is more than one status that is considered "open." The original version wasn't incrementing, just reassigning.

thraxisp

thraxisp

2005-08-21 18:09

reporter   ~0011256

This was fixed in the same change as 0005336.