logo       


mantisbt/core summary_api.php,1.48,1.49: msg#00067

Subject: mantisbt/core summary_api.php,1.48,1.49
Update of /cvsroot/mantisbt/mantisbt/core
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31387/core

Modified Files:
        summary_api.php 
Log Message:
Fix 8150: Summary By Date could show also resolved bugs count

Index: summary_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/summary_api.php,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- summary_api.php     15 Jul 2007 07:20:49 -0000      1.48
+++ summary_api.php     16 Jul 2007 08:23:39 -0000      1.49
@@ -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,26 +195,81 @@
                $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] );
+               foreach ( $p_date_array as $t_days ) {
+                       $t_new_count = summary_new_bug_count_by_date( $t_days );
+                       $t_resolved_count = summary_resolved_bug_count_by_date( 
$t_days );
 
-                       $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' ) . '&amp;do_filter_by_date=on&amp;start_year=' . 
date( 'Y', $t_start_date ) . '&amp;start_month=' . date( 'm', $t_start_date ) . 
'&amp;start_day=' . date( 'd', $t_start_date ) . '&amp;hide_status=">';
+                       $t_start_date = mktime( 0, 0, 0, date( 'm' ), ( date( 
'd' ) - $t_days ), date( 'Y' ) );
+                       $t_new_bugs_link = '<a class="subtle" href="' 
+                               . config_get( 'bug_count_hyperlink_prefix' ) 
+                               . '&amp;do_filter_by_date=on&amp;start_year=' . 
date( 'Y', $t_start_date ) 
+                               . '&amp;start_month=' . date( 'm', 
$t_start_date ) 
+                               . '&amp;start_day=' . date( 'd', $t_start_date 
) 
+                               . '&amp;hide_status=">';
+                       
+                       print( "<tr " . helper_alternate_class() . ">\n" );
+                       print( "    <td width=\"50%\">".  $t_days . "</td>\n" );
 
-                       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>' );
+                       if ( $t_new_count > 0 ) {
+                               print( "    <td 
class=\"right\">$t_new_bugs_link$t_new_count</a></td>\n" );
                        } else {
-                               printf( '<td class="right">%s</td>', 
$t_enum_count );
+                               print( "    <td 
class=\"right\">$t_new_count</td>\n" );
                        }
-                       print( '</tr>' );
-               } # end for
+                       print( "    <td 
class=\"right\">$t_resolved_count</td>\n" );
+
+                       $t_balance = $t_new_count - $t_resolved_count;
+                       $t_style = "";
+                       if ( $t_balance > 0 ) {
+                               # we are talking about bugs: a balance > 0 is 
"negative" for the project...
+                               $t_style = " negative";
+                               $t_balance = sprintf( '%+d', $t_balance ); # 
"+" modifier added in PHP >= 4.3.0
+                       } elseif ( $t_balance < 0 ) {
+                               $t_style = " positive";
+                               $t_balance = sprintf( '%+d', $t_balance );
+                       }
+
+                       print( "\n<td 
class=\"right$t_style\">$t_balance</td>\n" );
+                       print( "</tr>\n" );
+               } # end foreach
        }
        # --------------------
        # print bug counts by assigned to each developer


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe