Adding data intra-day.

This commit is contained in:
Sergiotarxz 2023-05-07 06:33:27 +02:00
parent ae8415758b
commit 6214205a56
2 changed files with 24 additions and 0 deletions

View File

@ -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'

View File

@ -11,6 +11,10 @@
<table>
<tr>
<th>Path</th>
<th data-sort-method="number">Visitors 1h</th>
<th data-sort-method="number">Visitors 3h</th>
<th data-sort-method="number">Visitors 6h</th>
<th data-sort-method="number">Visitors 12h</th>
<th data-sort-method="number">Visitors 24h</th>
<th data-sort-method="number">Visitors week</th>
<th data-sort-method="number">Visitors month</th>
@ -18,6 +22,10 @@
% for my $row (@$tracking_by_url) {
<tr>
<td><%="${base_url}$row->{path}"%></td>
<td><%=$row->{unique_ips_last_1_hour}%></td>
<td><%=$row->{unique_ips_last_3_hours}%></td>
<td><%=$row->{unique_ips_last_6_hours}%></td>
<td><%=$row->{unique_ips_last_12_hours}%></td>
<td><%=$row->{unique_ips_last_24_hours}%></td>
<td><%=$row->{unique_ips_last_week}%></td>
<td><%=$row->{unique_ips_last_month}%></td>