From 5a32d7e8f75fc9626daef699618528de1eadfa91 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 2 Feb 2025 17:04:24 +0200 Subject: collect filtered --- foostats.pl | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/foostats.pl b/foostats.pl index 9a49876..e3600f1 100644 --- a/foostats.pl +++ b/foostats.pl @@ -433,8 +433,9 @@ package Foostats::Reporter { my @stats = stats_for_date($stats_dir, $date); my %report = ( - feed_subscribers => feed_subscribers(@stats), - # TODO: Page views stats + feed_ips => feed_ips(@stats), + count => count(@stats), + page_ips => page_ips(@stats), ); return \%report; @@ -467,7 +468,7 @@ package Foostats::Reporter { } } - sub feed_subscribers (@stats) { + sub feed_ips (@stats) { my (%gemini, %web); for my $stats (@stats) { @@ -491,6 +492,30 @@ package Foostats::Reporter { return \%report; } + sub count (@stats) { + my %report; + + for my $stats (@stats) { + next unless exists $stats->{count}; + + while (my ($key, $val) = each $stats->{count}->%*) { + $report{$key} //= 0; + $report{$key} += $val; + } + } + + return \%report; + } + + sub page_ips (@stats) { + my %report = (); + + for my $stats (@stats) { + } + + return \%report; + } + sub stats_for_date ($stats_dir, $date) { my @stats; -- cgit v1.2.3