X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=blobdiff_plain;f=bin%2Fgroupstats.pl;h=bcb2b611974c78411f526e36674b40e1b7bac350;hp=7a3f7e46ce2e0fb224968e3a693f426d80acdb87;hb=ea91003a99e679caa5bf56915f085a7c4931805b;hpb=1af57a53905788c99a088bb6b17088293c0224d1 diff --git a/bin/groupstats.pl b/bin/groupstats.pl index 7a3f7e4..bcb2b61 100755 --- a/bin/groupstats.pl +++ b/bin/groupstats.pl @@ -126,12 +126,17 @@ if ($OptBoundType and $OptBoundType ne 'default') { } ### get sort order and build SQL 'ORDER BY' clause +# force to 'month' for $OptReportType 'average' or 'sum' +$OptGroupBy = 'month' if ($OptReportType and $OptReportType ne 'default'); # default to 'newsgroup' for $OptBoundType 'level' or 'average' $OptGroupBy = 'newsgroup' if (!$OptGroupBy and $OptBoundType and $OptBoundType ne 'default'); -# force to 'month' for $OptReportType 'average' or 'sum' -$OptGroupBy = 'month' if ($OptReportType and $OptReportType ne 'default'); +# default to 'newsgroup' if $OptGroupBy is not set and +# just one newsgroup is requested, but more than one month +$OptGroupBy = 'newsgroup' if (!$OptGroupBy and + $OptMonth =~ /:/ and $OptNewsgroups !~ /[:*%]/); # parse $OptGroupBy to $GroupBy, create ORDER BY clause $SQLOrderClause +# if $OptGroupBy is still not set, SQLSortOrder() will default to 'month' my ($GroupBy,$SQLOrderClause) = SQLSortOrder($OptGroupBy, $OptOrderBy); # $GroupBy will contain 'month' or 'newsgroup' (parsed result of $OptGroupBy) # set it to 'month' or 'key' for OutputData()