View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003478 | mantisbt | sql | public | 2003-12-25 18:31 | 2007-07-29 11:27 |
| Reporter | steffi | Assigned To | giallu | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| OS | Windows XP | OS Version | SP 1 | ||
| Product Version | 0.18.0 | ||||
| Summary | 0003478: 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. | ||||
| Tags | No 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 );
| ||||
|
Attached a patch against 0.18.2 to not sum up the bug count on each partition. |
|
|
AFAICT, this behaviour is "by design": each line of the "By Date" table counts issues opened in the last X days. On the other hand, I think your use case is covered by 0004969. |
|
|
Since the reported behaviour is by design and the usage case will be covered in the other report, I'm closing this |
|