Skip to content

Commit

Permalink
Item9652: count totals correctly
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@8981 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Sep 9, 2010
1 parent 6dd30fe commit 1e6e92c
Showing 1 changed file with 23 additions and 29 deletions.
52 changes: 23 additions & 29 deletions core/tools/develop/analyse.pl
Expand Up @@ -71,8 +71,8 @@
my $repositoryRevision = `$svnlook youngest $REPOS`;

my $coreExt = join( '|',
map { $_ =~ s/^.*\///; $_ }
split( "\n", `grep '!include ' $MANIFEST` ) );
map { $_ =~ s/^.*\///; $_ }
split( "\n", `grep '!include ' $MANIFEST` ) );

# First load and update WhoDunnit.sid2cin, the list of checkers-in for each rev
my $maxSid = 0;
Expand Down Expand Up @@ -113,28 +113,25 @@
opendir( D, $BUGS ) || die "$!";
foreach my $item (
sort { $a <=> $b }
grep { s/^Item(\d+)\.txt$/$1/ } readdir(D)
)
{
grep { s/^Item(\d+)\.txt$/$1/ } readdir(D)
) {
print "Item$item \r" if DEBUG;
my $bh;
open( $bh, '<', "$BUGS/Item$item.txt" ) || next;
local $/;
my $bug = <$bh>;
close($bh);
my %field;
while ( $bug =~ s/^%META:FIELD.*name="(\w+)".*value="(.*?)".*%$//m )
{
while ( $bug =~ s/^%META:FIELD.*name="(\w+)".*value="(.*?)".*%$//m ) {
$field{$1} = $2;
}
if (
(
$field{AppliesTo} eq "Engine"
|| $field{Extension} =~ /\b($coreExt)\b/
)
&& $field{CurrentState} =~ /(Closed|Waiting for Release)/i
)
{
$field{AppliesTo} eq "Engine"
|| $field{Extension} =~ /\b($coreExt)\b/
)
&& $field{CurrentState} =~ /(Closed|Waiting for Release)/i
) {
foreach my $cin ( split( /\s+/, $field{Checkins} ) ) {
$cin =~ s/^\w+://; # remove interwiki thingy
my $who = $sid2who{$cin};
Expand All @@ -145,16 +142,16 @@
}
}
$priority{$item} = $field{Priority};
$field{ReportedBy} =~ s/((TWiki|Foswiki):)?Main\.//g;
$field{ReportedBy} =~ s/((TWiki|Foswiki):)?Main\.//g;
$reportedBy{$field{ReportedBy}}++;

# Not used yet; may be used to build a table of who
# contributed to which releases
#if ($field{ReleasedIn} && $field{ReleasedIn} =~ /^\d/) {
# while ($field{ReleasedIn} !~ /\d+\.\d+\.\d+$/) {
# $field{ReleasedIn} .= '.0';
# $field{ReleasedIn} .= '.0';
# }
# $unleashed{$item} = $field{ReleasedIn};
# $unleashed{$item} = $field{ReleasedIn};
#}
}
else {
Expand Down Expand Up @@ -208,6 +205,7 @@
my ( %majorc, %minorc, %patchc, %counts );
foreach my $zapper ( keys %zappedBy ) {
while ( my ( $item, $cin ) = each %{ $zappedBy{$zapper} } ) {
$counts{$zapper}++;
next if $priority{$item} eq 'Enhancement';
if ( $cin > $revs{$major} ) {
if ( $cin > $revs{$minor} ) {
Expand All @@ -218,7 +216,6 @@
}
$majorc{$zapper}++;
}
$counts{$zapper}++;
}
}

Expand Down Expand Up @@ -254,10 +251,10 @@

}
print $ofh
($doPatch ? '| total | ' . List::Util::sum( values(%patchc).' ' ):'')
. ($doMinor ? '| total | ' . List::Util::sum( values(%minorc).' ' ):'')
. '| total | ' . List::Util::sum( values(%majorc) )
. " |\n";
($doPatch ? '| total | ' . List::Util::sum( values(%patchc).' ' ):'')
. ($doMinor ? '| total | ' . List::Util::sum( values(%minorc).' ' ):'')
. '| total | ' . List::Util::sum( values(%majorc) )
. " |\n";

print $ofh <<STUFF;
%STOPINCLUDE%
Expand All @@ -276,7 +273,6 @@
%majorc = ();
%minorc = ();
%patchc = ();
%counts = ();
foreach my $zapper ( keys %zappedBy ) {
while ( my ( $item, $cin ) = each %{ $zappedBy{$zapper} } ) {
next unless $priority{$item} eq 'Enhancement';
Expand All @@ -289,7 +285,6 @@
}
$majorc{$zapper}++;
}
$counts{$zapper}++;
}
}

Expand Down Expand Up @@ -325,10 +320,10 @@

}
print $ofh
($doPatch ? '| total | ' . List::Util::sum( values(%patchc).' ' ):'')
. ($doMinor ? '| total | ' . List::Util::sum( values(%minorc).' ' ):'')
. '| total | ' . List::Util::sum( values(%majorc) )
. " |\n";
($doPatch ? '| total | ' . List::Util::sum( values(%patchc).' ' ):'')
. ($doMinor ? '| total | ' . List::Util::sum( values(%minorc).' ' ):'')
. '| total | ' . List::Util::sum( values(%majorc) )
. " |\n";
print $ofh "%STOPINCLUDE%\n";

print $ofh <<STUFF;
Expand All @@ -337,8 +332,7 @@
of this database in October 2008.
| *Who* | *Tasks Opened* | *Tasks Closed* |
STUFF
foreach my $zapper ( sort { $counts{$b} <=> $counts{$a} } keys %counts )
{
foreach my $zapper ( sort { $counts{$b} <=> $counts{$a} } keys %counts ) {
next unless $zapper;
print $ofh "| [[Main.$zapper][$zapper]] | $reportedBy{$zapper} | $counts{$zapper} |\n";
}
Expand Down

0 comments on commit 1e6e92c

Please sign in to comment.