correcting notification times not being seen as ints
Security / security (push) Successful in 1m4s

This commit is contained in:
2026-05-13 21:36:58 -05:00
parent adf42df4a7
commit 1dc15708b9
+7 -2
View File
@@ -3,7 +3,7 @@
[string] $dtAPIKey = $ENV:DONETICKAPIKEY
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
[int[]] $notificationTimes = $ENV:NOTIFICATIONTIMES | Sort-Object
[int[]] $notificationTimes = $ENV:NOTIFICATIONTIMES -split ","
function Send-Notification
@@ -51,6 +51,10 @@ function Get-Chores
}
}
if (-not $notificationTimes) { $notificationTimes = @(8) }
else { $notificationTimes = $notificationTimes | Sort-Object }
Write-Host "Notification times: $notificationTimes"
while ($true) {
$today = (Get-Date "23:59:59")
$chores = Get-Chores
@@ -122,8 +126,9 @@ while ($true) {
}
if ($nextNotificationTomorrow)
{
$time = $notificationTimes[0]
Write-Host "Next notification time is $time`:00"
$diff = 24 - $now.Hour + $notificationTimes[0]
$diff = 24 - $now.Hour + $time
$sleepTime = $diff * 60 * 60 # hours * mins * seconds
Write-Host "Sleeping for $sleepTime seconds"
Start-Sleep -Seconds $sleepTime