View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005684 | mantisbt | other | public | 2005-05-31 12:41 | 2005-09-11 08:10 |
| Reporter | RJelinek | Assigned To | thraxisp | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.0.0a2 | ||||
| Fixed in Version | 1.0.0rc2 | ||||
| Summary | 0005684: 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) | ||||
| Tags | No 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 );
}
}
} | ||||
|
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. |
|
|
This was fixed in the same change as 0005336. |
|