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, },