diff --git a/lib/BurguillosInfo/Tracking.pm b/lib/BurguillosInfo/Tracking.pm index d6f9f75..b92fc78 100644 --- a/lib/BurguillosInfo/Tracking.pm +++ b/lib/BurguillosInfo/Tracking.pm @@ -104,6 +104,22 @@ EOF my $dbh = BurguillosInfo::DB->connect($app); my $data = $dbh->selectall_arrayref(<<"EOF", {Slice => {}}); SELECT paths.path, + ( + $SELECT_GLOBAL + where requests.path = paths.path and date > NOW() - interval '1 hour' + ) as unique_ips_last_1_hour, + ( + $SELECT_GLOBAL + where requests.path = paths.path and date > NOW() - interval '3 hour' + ) as unique_ips_last_3_hours, + ( + $SELECT_GLOBAL + where requests.path = paths.path and date > NOW() - interval '6 hour' + ) as unique_ips_last_6_hours, + ( + $SELECT_GLOBAL + where requests.path = paths.path and date > NOW() - interval '12 hour' + ) as unique_ips_last_12_hours, ( $SELECT_GLOBAL where requests.path = paths.path and date > NOW() - interval '1 day' diff --git a/templates/metrics/stats.html.ep b/templates/metrics/stats.html.ep index 615046f..4409907 100644 --- a/templates/metrics/stats.html.ep +++ b/templates/metrics/stats.html.ep @@ -11,6 +11,10 @@ + + + + @@ -18,6 +22,10 @@ % for my $row (@$tracking_by_url) { + + + +
PathVisitors 1hVisitors 3hVisitors 6hVisitors 12h Visitors 24h Visitors week Visitors month
<%="${base_url}$row->{path}"%><%=$row->{unique_ips_last_1_hour}%><%=$row->{unique_ips_last_3_hours}%><%=$row->{unique_ips_last_6_hours}%><%=$row->{unique_ips_last_12_hours}%> <%=$row->{unique_ips_last_24_hours}%> <%=$row->{unique_ips_last_week}%> <%=$row->{unique_ips_last_month}%>