munin: fix date range calculation
TODO: handle CET -> CEST transition (there's a day each year where 2am does not exist and DateTime does not like it)
This commit is contained in:
parent
11727e0f99
commit
1f3b3c742c
1 changed files with 9 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
package Travelynx::Command::munin;
|
||||
|
||||
# Copyright (C) 2020 Daniel Friesel
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
@ -48,16 +49,17 @@ sub run {
|
|||
query_to_munin(
|
||||
'checkins_24h',
|
||||
$db->query( $checkin_window_query,
|
||||
$now->subtract( hours => 24 )->epoch )->hash->{count}
|
||||
$now->clone->subtract( hours => 24 )->epoch )->hash->{count}
|
||||
);
|
||||
query_to_munin(
|
||||
'checkins_7d',
|
||||
$db->query( $checkin_window_query,
|
||||
$now->clone->subtract( days => 7 )->epoch )->hash->{count}
|
||||
);
|
||||
query_to_munin( 'checkins_7d',
|
||||
$db->query( $checkin_window_query, $now->subtract( days => 7 )->epoch )
|
||||
->hash->{count} );
|
||||
query_to_munin(
|
||||
'checkins_30d',
|
||||
$db->query(
|
||||
$checkin_window_query, $now->subtract( days => 30 )->epoch
|
||||
)->hash->{count}
|
||||
$db->query( $checkin_window_query,
|
||||
$now->clone->subtract( days => 30 )->epoch )->hash->{count}
|
||||
);
|
||||
query_to_munin( 'polylines',
|
||||
$db->select( 'polylines', 'count(*) as count' )->hash->{count} );
|
||||
|
|
Loading…
Reference in a new issue