From 75d85d874158405a67b31633649dc0ebef0f2830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Fri, 23 Jun 2023 13:52:55 +0200 Subject: [PATCH] [int] --- source/logic/main.ts | 5 ++++- source/logic/state_repository.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/logic/main.ts b/source/logic/main.ts index a4ddf89..6987790 100644 --- a/source/logic/main.ts +++ b/source/logic/main.ts @@ -323,7 +323,10 @@ async function main( // TODO: type let old_item_state : (null | _heimdall.type_item_state); - let last_notification_timestamp : (null | int); + const last_notification_timestamp : (null | int) = await _heimdall.state_repository.get_last_notification_timestamp( + database_path, + check.name + ); if (rows.length <= 0) { old_item_state = null; diff --git a/source/logic/state_repository.ts b/source/logic/state_repository.ts index f28d0d4..63b502b 100644 --- a/source/logic/state_repository.ts +++ b/source/logic/state_repository.ts @@ -119,7 +119,7 @@ namespace _heimdall.state_repository const rows : Array> = await _heimdall.helpers.sqlite.query_get( database_path, { - "template": "SELECT MIN(timestamp) FROM results WHERE (check_name = :check_name) AND (notification_sent = TRUE);", + "template": "SELECT MAX(timestamp) FROM results WHERE (check_name = :check_name) AND (notification_sent = TRUE);", "arguments": { "check_name": check_name, },