View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008150 | mantisbt | bugtracker | public | 2007-07-13 19:23 | 2007-12-21 23:16 |
Reporter | giallu | Assigned To | giallu | ||
Priority | normal | Severity | feature | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Target Version | 1.1.0 | Fixed in Version | 1.1.0a4 | ||
Summary | 0008150: Summary By Date could show also resolved bugs count | ||||
Description | The summary "By Date" shows the number of opened reports in the last x days. | ||||
Tags | No tags attached. | ||||
Attached Files | bug8150.patch (6,389 bytes)
? bug2077.patch ? bug8150.patch ? publish.sh ? test.php Index: summary_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/summary_page.php,v retrieving revision 1.49 diff -u -r1.49 summary_page.php --- summary_page.php 20 Sep 2006 04:31:44 -0000 1.49 +++ summary_page.php 14 Jul 2007 08:43:04 -0000 @@ -239,9 +239,10 @@ <?php # DATE # ?> <table class="width100" cellspacing="1"> <tr> - <td class="form-title" colspan="5"> - <?php echo lang_get( 'by_date' ) ?> - </td> + <td class="form-title"><?php echo lang_get( 'by_date' ); ?></td> + <td class="right"><?php echo lang_get( 'legend_opened' ); ?></td> + <td class="right"><?php echo lang_get( 'legend_resolved' ); ?></td> + <td class="right"><?php echo lang_get( 'balance' ); ?></td> </tr> <?php summary_print_by_date( config_get( 'date_partitions' ) ) ?> </table> Index: core/summary_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/summary_api.php,v retrieving revision 1.47 diff -u -r1.47 summary_api.php --- core/summary_api.php 13 Jul 2007 22:22:26 -0000 1.47 +++ core/summary_api.php 14 Jul 2007 08:43:05 -0000 @@ -171,10 +171,12 @@ summary_helper_print_row( get_enum_element( $p_enum, $t_last_value), $t_bugs_open, $t_bugs_resolved, $t_bugs_closed, $t_bugs_total ); } } + + # -------------------- # prints the bugs submitted in the last X days (default is 1 day) for the # current project - function summary_bug_count_by_date( $p_time_length=1 ) { + function summary_new_bug_count_by_date( $p_time_length=1 ) { $t_mantis_bug_table = config_get( 'mantis_bug_table' ); $c_time_length = (int)$p_time_length; @@ -193,25 +195,79 @@ $result = db_query( $query ); return db_result( $result, 0 ); } + + + # -------------------- + # returns the number of bugs resolved in the last X days (default is 1 day) for the + # current project + function summary_resolved_bug_count_by_date( $p_time_length = 1 ) { + $t_bug_table = config_get( 'mantis_bug_table' ); + $t_bug_history_table = config_get( 'mantis_bug_history_table' ); + $t_resolved = config_get( 'bug_resolved_status_threshold' ); + + + $c_time_length = (int)$p_time_length; + + $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; + } + + $query = "SELECT COUNT(*) + FROM $t_bug_table b + LEFT JOIN $t_bug_history_table h + ON b.id = h.bug_id + AND h.type = " . NORMAL_TYPE ." + AND h.field_name = 'status' + AND h.new_value = '$t_resolved' + WHERE b.status >= '$t_resolved' + AND ".db_helper_compare_days(db_now(),"date_modified","<= '$c_time_length'")." + AND $specific_where"; + $result = db_query( $query ); + return db_result( $result, 0 ); + } + # -------------------- # This function shows the number of bugs submitted in the last X days # An array of integers representing days is passed in function summary_print_by_date( $p_date_array ) { $arr_count = count( $p_date_array ); for ($i=0;$i<$arr_count;$i++) { - $t_enum_count = summary_bug_count_by_date( $p_date_array[$i] ); + $t_new_count = summary_new_bug_count_by_date( $p_date_array[$i] ); + $t_resolved_count = summary_resolved_bug_count_by_date( $p_date_array[$i] ); $t_start_date = mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) - $p_date_array[$i] ), date( 'Y' ) ); - $t_bug_link = '<a class="subtle" href="' . config_get( 'bug_count_hyperlink_prefix' ) . '&do_filter_by_date=on&start_year=' . date( 'Y', $t_start_date ) . '&start_month=' . date( 'm', $t_start_date ) . '&start_day=' . date( 'd', $t_start_date ) . '&hide_status=">'; + $t_new_bugs_link = '<a class="subtle" href="' + . config_get( 'bug_count_hyperlink_prefix' ) + . '&do_filter_by_date=on&start_year=' . date( 'Y', $t_start_date ) + . '&start_month=' . date( 'm', $t_start_date ) + . '&start_day=' . date( 'd', $t_start_date ) + . '&hide_status=">'; + + print( "<tr " . helper_alternate_class() . ">\n" ); + print( " <td width=\"50%\">". $p_date_array[$i] . "</td>\n" ); + if ( $t_new_count > 0 ) { + print( " <td class=\"right\">$t_new_bugs_link$t_new_count</a></td>\n" ); + } else { + print( " <td class=\"right\">$t_new_count</td>\n" ); + } + if ( $t_resolved_count > 0 ) { + printf( ' <td class="right">%s</td>', /*$t_bug_link .*/ $t_resolved_count /*. '</a>'*/ ); + } else { + printf( ' <td class="right">%s</td>', $t_resolved_count ); + } - printf( '<tr %s>', helper_alternate_class() ); - printf( '<td width="50%%">%s</td>', $p_date_array[$i] ); - if ( 0 < $t_enum_count ) { - printf( '<td class="right">%s</td>', $t_bug_link . $t_enum_count . '</a>' ); + $t_balance = sprintf( '%+d', $t_new_count - $t_resolved_count ); # + modifier in PHP >= 4.3.0 + if ($t_balance > 0) { + $t_style = "style=\"color:red;\""; } else { - printf( '<td class="right">%s</td>', $t_enum_count ); + $t_style = "style=\"color:green;\""; } - print( '</tr>' ); + print( "\n<td class=\"right\" $t_style>$t_balance</td>\n" ); + print( "</tr>\n" ); } # end for } # -------------------- @@ -600,7 +656,7 @@ $t_arr = db_fetch_array( $result ); } - $t_filter_prefix = config_get( 'bug_count_hyperlink_prefix' ); + $t_filter_prefix = config_get( 'bug_count_hyperlink_prefix' ); $t_row_count = 0; # We now have a multi dimensional array of users and resolutions, with the value of each resolution for each user foreach( $t_handler_res_arr as $t_handler_id => $t_arr2 ) { Index: lang/strings_english.txt =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v retrieving revision 1.301 diff -u -r1.301 strings_english.txt --- lang/strings_english.txt 4 Jul 2007 05:36:08 -0000 1.301 +++ lang/strings_english.txt 14 Jul 2007 08:43:06 -0000 @@ -1066,6 +1066,7 @@ $s_percentage_errors = '% False'; $s_errors = 'False'; $s_total = 'Total'; +$s_balance = 'Balance'; $s_time_stats = 'Time Stats For Resolved Issues (days)'; $s_longest_open_bug = 'Longest open issue'; $s_longest_open = 'Longest open'; | ||||
related to | 0006313 | new | Show last update on issues like creation in summary |
MantisBT: master 42766d28 2007-07-16 04:23 Details Diff |
Fix 8150: Summary By Date could show also resolved bugs count git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4445 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0008150 |
|
mod - core/summary_api.php | Diff File | ||
mod - summary_page.php | Diff File | ||
mod - css/default.css | Diff File | ||
mod - lang/strings_english.txt | Diff File |