Skip to content

Commit

Permalink
Fix 8208: Most popular bug table on summary page
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4517 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
giallu committed Jul 31, 2007
1 parent e7ef738 commit f2cda93
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
43 changes: 41 additions & 2 deletions core/summary_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: summary_api.php,v 1.49 2007-07-16 08:23:39 giallu Exp $
# $Id: summary_api.php,v 1.50 2007-07-31 22:55:03 giallu Exp $
# --------------------------------------------------------

### Summary printing API ###
Expand Down Expand Up @@ -221,7 +221,6 @@ function summary_resolved_bug_count_by_date( $p_time_length = 1 ) {
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";
Expand Down Expand Up @@ -271,6 +270,46 @@ function summary_print_by_date( $p_date_array ) {
print( "</tr>\n" );
} # end foreach
}


# Print list of open bugs with the highest activity score
# the score is calculated assigning one "point" for each history event
# associated with the bug
function summary_print_by_activity() {
$t_mantis_bug_table = config_get( 'mantis_bug_table' );
$t_mantis_history_table = config_get( 'mantis_bug_history_table' );

$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
$t_resolved = config_get( 'bug_resolved_status_threshold' );

$specific_where = helper_project_specific_where( $t_project_id );
if ( ' 1<>1' == $specific_where ) {
return;
}
$query = "SELECT COUNT(h.id) as count, b.id, b.summary
FROM $t_mantis_bug_table AS b, $t_mantis_history_table AS h
WHERE h.bug_id = b.id
AND b.status < $t_resolved
AND $specific_where
GROUP BY h.bug_id
ORDER BY count DESC, b.last_updated DESC";
$result = db_query( $query );

$t_count = 0;
while ( $row = db_fetch_array( $result ) ) {
if ( $t_count++ == 10 ) break;
$t_bugid = string_get_bug_view_link( $row['id'] );
$t_summary = $row['summary'];
$t_notescount = $row['count'];

print "<tr " . helper_alternate_class() . ">\n";
print "<td class=\"small\">$t_bugid - $t_summary</td><td class=\"right\">$t_notescount</td>\n";
print "</tr>\n";
}
}


# --------------------
# print bug counts by assigned to each developer
function summary_print_by_developer() {
Expand Down
10 changes: 6 additions & 4 deletions lang/strings_english.txt
Expand Up @@ -11,11 +11,11 @@
###########################################################################
# English strings for Mantis (source language for translations)
# -------------------------------------------------
# $Revision: 1.307 $
# $Author: zakman $
# $Date: 2007-07-31 20:28:49 $
# $Revision: 1.308 $
# $Author: giallu $
# $Date: 2007-07-31 22:55:04 $
#
# $Id: strings_english.txt,v 1.307 2007-07-31 20:28:49 zakman Exp $
# $Id: strings_english.txt,v 1.308 2007-07-31 22:55:04 giallu Exp $
###########################################################################

?>
Expand Down Expand Up @@ -1070,6 +1070,8 @@ $s_percentage_errors = '% False';
$s_errors = 'False';
$s_total = 'Total';
$s_balance = 'Balance';
$s_most_active = 'Most Active';
$s_score = 'Score';
$s_time_stats = 'Time Stats For Resolved Issues (days)';
$s_longest_open_bug = 'Longest open issue';
$s_longest_open = 'Longest open';
Expand Down
13 changes: 12 additions & 1 deletion summary_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: summary_page.php,v 1.52 2007-07-25 15:53:32 giallu Exp $
# $Id: summary_page.php,v 1.53 2007-07-31 22:55:00 giallu Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -257,6 +257,17 @@

<br />

<?php # ACTIVITY # ?>
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" width="86%"><?php echo lang_get( 'most_active' ); ?></td>
<td class="right" width="14%"><?php echo lang_get( 'score' ); ?></td>
</tr>
<?php summary_print_by_activity() ?>
</table>

<br />

<?php # RESOLUTION # ?>
<table class="width100" cellspacing="1">
<tr>
Expand Down

0 comments on commit f2cda93

Please sign in to comment.