View Issue Details

IDProjectCategoryView StatusLast Update
0008231mantisbtbugtrackerpublic2007-10-04 01:40
Reportergiallu Assigned Togiallu  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.1.0rc1 
Summary0008231: Summary "By Date" shows suspicious totals
Description

The current "By Date" summary is:


By Date (days) Opened Resolved Balance
1 3 3 0
2 6 307 -301
3 12 313 -301
7 19 345 -326
30 87 619 -532
60 179 692 -513
90 264 972 -708
180 420 1113 -693
365 781 1524 -743

which looks like the query calculating resolved issues is not behaving correctly

TagsNo tags attached.

Activities

giallu

giallu

2007-08-04 10:35

reporter   ~0015346

It seems we are double (triple?) counting some bugs due to a sub-optimal query.

I think I will simplify the query with something like:


Index: core/summary_api.php

RCS file: /cvsroot/mantisbt/mantisbt/core/summary_api.php,v
retrieving revision 1.52
diff -u -r1.52 summary_api.php
--- core/summary_api.php 1 Aug 2007 15:20:45 -0000 1.52
+++ core/summary_api.php 4 Aug 2007 14:33:53 -0000
@@ -202,7 +202,6 @@

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;

    @@ -216,13 +215,9 @@
    }

            $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'
  • WHERE b.status >= '$t_resolved'
  • AND ".db_helper_compare_days(db_now(),"date_modified","<= '$c_time_length'")."
  • FROM $t_bug_table
  • WHERE " . db_helper_compare_days(db_now(),"last_updated","<= '$c_time_length'") . "
  • AND status >= '$t_resolved'
    AND $specific_where";
    $result = db_query( $query );
    return db_result( $result, 0 );

giallu

giallu

2007-08-04 17:08

reporter   ~0015347

At last, I fixed the original query without rewriting it all.

Any testers with DBs other than MySQL appreciated

Related Changesets

MantisBT: master cf07f3ba

2007-08-04 17:06

giallu


Details Diff
Fix 8231: Summary "By Date" shows suspicious totals

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4531 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0008231
mod - core/summary_api.php Diff File