From: Thomas Hochstein Date: Tue, 3 Sep 2013 20:25:23 +0000 (+0200) Subject: Merge branch 'thh-bug51' into next X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=commitdiff_plain;h=599fefbf6aea5777c2958718048ad3e3a12050fc;hp=7624accb6e76d2badc0154d387dc213cd6687ced Merge branch 'thh-bug51' into next * thh-bug51: One more default sorting order ("grouping"). --- diff --git a/bin/groupstats.pl b/bin/groupstats.pl index d03c582..7f3a32c 100755 --- a/bin/groupstats.pl +++ b/bin/groupstats.pl @@ -133,12 +133,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()