View Issue Details

IDProjectCategoryView StatusLast Update
0003478mantisbtsqlpublic2007-07-29 11:27
Reportersteffi Assigned Togiallu  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
OSWindows XPOS VersionSP 1 
Product Version0.18.0 
Summary0003478: summary by date isn't correct
Description

As I used before 0.17.3 there is now an incorrect addition of bugs sorted by date in the summary.
I only have 3 opened bugs - 1 to 3 days old - but they are listed in all array-categories of $g_date_partitions.
Maybe the problem is, that there is a reset to 0 missing to any varbiable?

TagsNo tags attached.
Attached Files
summary_api.php.diff (1,957 bytes)   
--- ./mantis-0.18.2/core/summary_api.php	2004-02-11 00:33:48.000000000 +0100
+++ ./mantis-0.18.2-BEG/core/summary_api.php	2004-04-01 14:49:52.000000000 +0200
@@ -94,6 +94,28 @@
 		}
 	}
 	# --------------------
+	# prints the bugs submitted within a date range for the
+	# current project
+	function summary_bug_count_by_date_range( $p_date_start, $p_date_end ) {
+		$t_mantis_bug_table = config_get( 'mantis_bug_table' );
+
+		$c_date_start = (integer)$p_date_start;
+		$c_date_end = (integer)$p_date_end;
+
+		$t_project = helper_get_current_project();
+
+		#checking if it's a per project statistic or all projects
+                if ( ALL_PROJECTS == $t_project_id ) $specific_where = ' 1=1';
+                else $specific_where = " project_id='$t_project_id'";
+
+		$query = "SELECT COUNT(*)
+				FROM $t_mantis_bug_table
+				WHERE date_submitted BETWEEN FROM_UNIXTIME('$c_date_start') AND FROM_UNIXTIME('$c_date_end')
+				AND $specific_where";
+		$result = db_query( $query );
+		return db_result( $result, 0 );
+	}
+	# --------------------
 	# 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 ) {
@@ -117,10 +139,13 @@
 	# 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 ) {
+		$end_date = time();
+		
 		$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_enum_count = summary_bug_count_by_date_range($end_date - $p_date_array[$i] * 86400, $end_date);
+			
+			$end_date = $end_date - $p_date_array[$i] * 86400;
 			printf( '<tr %s>', helper_alternate_class() );
 			printf( '<td width="50%%">%s</td>', $p_date_array[$i] );
 			printf( '<td class="right">%s</td>', $t_enum_count );
summary_api.php.diff (1,957 bytes)   

Relationships

related to 0004969 closedthraxisp Summary by date 

Activities

Apel

Apel

2004-04-02 05:17

reporter   ~0005327

Attached a patch against 0.18.2 to not sum up the bug count on each partition.

giallu

giallu

2007-07-16 04:12

reporter   ~0015034

AFAICT, this behaviour is "by design": each line of the "By Date" table counts issues opened in the last X days.
So, for example, "issues opened in the last 3 days" are also counted on "issues opened in the last 7 days".

On the other hand, I think your use case is covered by 0004969.

giallu

giallu

2007-07-29 11:27

reporter   ~0015273

Since the reported behaviour is by design and the usage case will be covered in the other report, I'm closing this