Commit 6a66c1b2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

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)
parent 74ae9825
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
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} );