Skip to content

Commit

Permalink
Custom reporter effectiveness multipliers
Browse files Browse the repository at this point in the history
Continuation of bug 10330 to remove hardcoded enum constants from the
Mantis codebase.

The summary reporter effectiveness statistics used to be generated by
using hardcoded multipliers for each different severity and resolution.
This posed a problem to anyone who defined their own custom severities
and resolutions, as there is no guarantee that the reporter
effectiveness would still remain a useful statistic.

This patch reintroduces the severity and resolution multipliers as user
customisable options in the Mantis configuration file. Users can now
correctly set the severity and resolution multipliers to custom values
and can define multipliers for custom severities and resolutions.
  • Loading branch information
davidhicks committed Jun 20, 2009
1 parent db4c72a commit e877da1
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 36 deletions.
30 changes: 30 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -1459,6 +1459,36 @@
*/
$g_view_summary_threshold = MANAGER;

/**
* Define the multipliers which are used to determine the effectiveness
* of reporters based on the severity of bugs. Higher multipliers will
* result in an increase in reporter effectiveness.
* @global array $g_severity_multipliers
*/
$g_severity_multipliers = array( FEATURE => 1,
TRIVIAL => 2,
TEXT => 3,
TWEAK => 2,
MINOR => 5,
MAJOR => 8,
CRASH => 8,
BLOCK => 10 );

/**
* Define the resolutions which are used to determine the effectiveness
* of reporters based on the resolution of bugs. Higher multipliers will
* result in a decrease in reporter effectiveness. The only resolutions
* that need to be defined here are those which match or exceed
* $g_bug_resolution_not_fixed_threshold.
* @global array $g_resolution_multipliers
*/
$g_resolution_multipliers = array( UNABLE_TO_DUPLICATE => 2,
NOT_FIXABLE => 1,
DUPLICATE => 3,
NOT_A_BUG => 5,
SUSPENDED => 1,
WONT_FIX => 1 );

/*****************************
* MantisBT Bugnote Settings *
*****************************/
Expand Down
48 changes: 12 additions & 36 deletions core/summary_api.php
Expand Up @@ -982,26 +982,14 @@ function summary_print_reporter_effectiveness( $p_severity_enum_string, $p_resol
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();

# These are our overall "values" for severities and non-bug results
$t_severity_multiplier[FEATURE] = 1;
$t_severity_multiplier[TRIVIAL] = 2;
$t_severity_multiplier[TEXT] = 3;
$t_severity_multiplier[TWEAK] = 2;
$t_severity_multiplier[MINOR] = 5;
$t_severity_multiplier[MAJOR] = 8;
$t_severity_multiplier[CRASH] = 8;
$t_severity_multiplier[BLOCK] = 10;
$t_severity_multiplier['average'] = 5;

$t_notbug_multiplier[UNABLE_TO_DUPLICATE] = 2;
$t_notbug_multiplier[DUPLICATE] = 3;
$t_notbug_multiplier[NOT_A_BUG] = 5;

# Get the severity values ot use
$t_severity_multipliers = config_get( 'severity_multipliers' );
$t_resolution_multipliers = config_get( 'resolution_multipliers' );

# Get the severity values to use
$c_sev_s = MantisEnum::getValues( $p_severity_enum_string );
$enum_sev_count = count( $c_sev_s );

# Get the resolution values ot use
# Get the resolution values to use
$c_res_s = MantisEnum::getValues( $p_resolution_enum_string );
$enum_res_count = count( $c_res_s );

Expand Down Expand Up @@ -1068,36 +1056,24 @@ function summary_print_reporter_effectiveness( $p_severity_enum_string, $p_resol

$t_total_severity = 0;
$t_total_errors = 0;
for( $j = 0;$j < $enum_sev_count;$j++ ) {
for( $j = 0; $j < $enum_sev_count; $j++ ) {
if( !isset( $t_arr2[$c_sev_s[$j]] ) ) {
continue;
}

$sev_bug_count = $t_arr2[$c_sev_s[$j]]['total'];
$t_sev_mult = $t_severity_multiplier['average'];
if( $t_severity_multiplier[$c_sev_s[$j]] ) {
$t_sev_mult = $t_severity_multiplier[$c_sev_s[$j]];
$t_sev_mult = 1;
if( $t_severity_multipliers[$c_sev_s[$j]] ) {
$t_sev_mult = $t_severity_multipliers[$c_sev_s[$j]];
}

if( $sev_bug_count > 0 ) {
$t_total_severity += ( $sev_bug_count * $t_sev_mult );
}

# Calculate the "error value" of bugs reported
$t_notbug_res_arr = array(
UNABLE_TO_DUPLICATE,
DUPLICATE,
NOT_A_BUG,
);

foreach( $t_notbug_res_arr as $t_notbug_res ) {
if( isset( $t_arr2[$c_sev_s[$j]][$t_notbug_res] ) ) {
$t_notbug_mult = 1;
if( $t_notbug_multiplier[$t_notbug_res] ) {
$t_notbug_mult = $t_notbug_multiplier[$t_notbug_res];
}

$t_total_errors += ( $t_sev_mult * $t_notbug_mult );
foreach( $t_resolution_multipliers as $t_res => $t_res_mult ) {
if( isset( $t_arr2[$c_sev_s[$j]][$t_res] ) ) {
$t_total_errors += ( $t_sev_mult * $t_res_mult );
}
}
}
Expand Down
58 changes: 58 additions & 0 deletions docbook/adminguide/en/configuration.sgml
Expand Up @@ -1374,6 +1374,64 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_severity_multipliers</term>
<listitem>
<para>An array of multipliers which are used to determine
the effectiveness of reporters based on the severity of
bugs. Higher multipliers will result in an increase in
reporter effectiveness. The default multipliers are:
<programlisting>$g_severity_multipliers = array ( FEATURE =&gt; 1,
TRIVIAL =&gt; 2,
TEXT =&gt; 3,
TWEAK =&gt; 2,
MINOR =&gt; 5,
MAJOR =&gt; 8,
CRASH =&gt; 8,
BLOCK =&gt; 10 );
</programlisting>
The keys of the array are severity constants from
constant_inc.php or from custom_constants_inc.php if
you have custom severities defined. The values are
integers, typically in the range of 0 to 10. If you
would like for a severity to not count towards
effectiveness, set the value to 0 for that severity.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_resolution_multipliers</term>
<listitem>
<para>An array of multipliers which are used to determine
the effectiveness of reporters based on the resolution
of bugs. Higher multipliers will result in a decrease
in reporter effectiveness. The only resolutions that
need to be defined here are those which match or exceed
$g_bug_resolution_not_fixed_threshold. The default
multipliers are:
<programlisting>$g_resolution_multipliers = array( UNABLE_TO_DUPLICATE =&gt; 2,
NOT_FIXABLE =&gt; 1,
DUPLICATE =&gt; 3,
NOT_A_BUG =&gt; 5,
SUSPENDED =&gt; 1,
WONT_FIX =&gt; 1 );
</programlisting>
The keys of the array are resolution constants from
constant_inc.php or from custom_constants_inc.php if
you have custom resolutions defined. Resolutions not
included here will be assumed to have a multiplier
value of 0. The values are integers, typically in the
range of 0 to 10. If you would like for a resolution to
not count towards effectiveness, set the value to 0 for
that resolution or remove it from the array completely.
Note that these resolution multipliers are stacked on
top of the severity multipliers. Therefore by default,
a user reporting many duplicate bugs at severity level
BLOCK will be far worse off than a user reporting many
duplicate bugs at severity level FEATURE.
</para>
</listitem>
</varlistentry>
</variablelist>

</section>
Expand Down

0 comments on commit e877da1

Please sign in to comment.