Index: summary_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/summary_page.php,v retrieving revision 1.45 diff -u -r1.45 summary_page.php --- summary_page.php 27 Apr 2005 02:20:13 -0000 1.45 +++ summary_page.php 17 Jun 2005 13:16:01 -0000 @@ -36,71 +42,7 @@ $t_project_ids = array_map( 'db_prepare_int', $t_project_ids ); - if ( 0 == count( $t_project_ids ) ) { - $specific_where = ' 1 <> 1'; - } elseif ( 1 == count( $t_project_ids ) ) { - $specific_where = ' project_id=' . $t_project_ids[0]; - } else { - $specific_where = ' project_id IN (' . join( ',', $t_project_ids ) . ')'; - } - - $t_bug_table = config_get( 'mantis_bug_table' ); - $t_history_table = config_get( 'mantis_bug_history_table' ); - - $t_clo_val = config_get( 'bug_resolved_status_threshold' ); - $query = "SELECT id, date_submitted, last_updated, status - FROM $t_bug_table - WHERE $specific_where AND status>='$t_clo_val'"; - $result = db_query( $query ); - $bug_count = db_num_rows( $result ); - - $t_bug_id = 0; - $t_largest_diff = 0; - $t_total_time = 0; - for ($i=0;$i<$bug_count;$i++) { - $row = db_fetch_array( $result ); - $t_date_submitted = db_unixtimestamp( $row['date_submitted'] ); - $t_last_updated = db_unixtimestamp( $row['last_updated'] ); - $t_id = $row['id']; - $t_status = $row['status']; - - # if the status is not the closed value, it may have passed through the - # status we consider closed (e.g., bug is CLOSED, not RESOLVED) - # we should look for the last time it was RESOLVED in the history - if ( $t_status <> $t_clo_val ) { - $query2 = "SELECT date_modified - FROM " . $t_history_table . " - WHERE bug_id=$t_id AND type=" . NORMAL_TYPE . - " AND field_name='status' AND new_value='$t_clo_val' - ORDER BY date_modified DESC"; - $result2 = db_query( $query2 ); - if ( db_num_rows( $result2 ) >= 1 ) { - # if any were found, read the first (oldest) one and update the timestamp - $row2 = db_fetch_array( $result2 ); - $t_last_updated = db_unixtimestamp( $row2['date_modified'] ); - } - } - - if ($t_last_updated < $t_date_submitted) { - $t_last_updated = 0; - $t_date_submitted = 0; - } - - $t_diff = $t_last_updated - $t_date_submitted; - $t_total_time = $t_total_time + $t_diff; - if ( $t_diff > $t_largest_diff ) { - $t_largest_diff = $t_diff; - $t_bug_id = $row['id']; - } - } - if ( $bug_count < 1 ) { - $bug_count = 1; - } - $t_average_time = $t_total_time / $bug_count; - - $t_largest_diff = number_format( $t_largest_diff / 86400, 2 ); - $t_total_time = number_format( $t_total_time / 86400, 2 ); - $t_average_time = number_format( $t_average_time / 86400, 2 ); + $t_time_stats = summary_get_time_stats(); $t_orct_arr = preg_split( '/[\)\/\(]/', lang_get( 'orct' ), -1, PREG_SPLIT_NO_EMPTY ); @@ -194,8 +137,8 @@