Merge branch 'gatherstats' into next

* gatherstats:
  Get empty 'virtual' hierarchies working.
This commit is contained in:
Thomas Hochstein 2013-09-02 06:46:40 +02:00
commit cce2fd0b7f
2 changed files with 11 additions and 8 deletions

View file

@ -33,6 +33,7 @@ require Exporter;
SplitPeriod SplitPeriod
ListMonth ListMonth
ListNewsgroups ListNewsgroups
ParseHierarchies
ReadGroupList ReadGroupList
OutputData OutputData
FormatOutput FormatOutput

View file

@ -19,7 +19,7 @@ BEGIN {
} }
use strict; use strict;
use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ReadGroupList); use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ParseHierarchies ReadGroupList);
use DBI; use DBI;
use Getopt::Long qw(GetOptions); use Getopt::Long qw(GetOptions);
@ -145,13 +145,15 @@ foreach my $Month (&ListMonth($Period)) {
if (%ValidGroups) { if (%ValidGroups) {
foreach (sort keys %ValidGroups) { foreach (sort keys %ValidGroups) {
if (!defined($Postings{$_})) { if (!defined($Postings{$_})) {
# expand newsgroup with hierarchies # add current newsgroup as empty group
my @Newsgroups = ParseHierarchies($_); $Postings{$_} = 0;
# add each empty newsgroup and empty hierarchies, too, as needed warn (sprintf("ADDED: %s as empty group\n",$_));
foreach (@Newsgroups) { # add empty hierarchies for current newsgroup as needed
if (!defined($Postings{$_})) { foreach (ParseHierarchies($_)) {
$Postings{$_} = 0; my $Hierarchy = $_ . '.ALL';
warn (sprintf("ADDED: %s as empty group\n",$_)); if (!defined($Postings{$Hierarchy})) {
$Postings{$Hierarchy} = 0;
warn (sprintf("ADDED: %s as empty group\n",$Hierarchy));
}; };
}; };
} }