diff options
Diffstat (limited to 'daemons')
-rw-r--r-- | daemons/next.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/daemons/next.php b/daemons/next.php index c004a66..5fcb6c3 100644 --- a/daemons/next.php +++ b/daemons/next.php @@ -110,6 +110,10 @@ usort($pairs2, function ($a, $b) use ($members) { if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); } + if (count($times) === 0) { + $times[] = INF; + } + $timeA = time() - min($times); $times = []; @@ -117,6 +121,10 @@ usort($pairs2, function ($a, $b) use ($members) { if (getLastFronted($members, $id) > 0) $times[] = getLastFronted($members, $id); } + if (count($times) === 0) { + $times[] = INF; + } + $timeB = time() - min($times); if ($timeA < 5 || $timeB < 5) { @@ -142,11 +150,11 @@ $list = [$requested[$i]]; if (count($list) > 1) { $str = implode(" or ", array_map(function ($i) { return (getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"]); - }, $list)) . " is fronting today."; + }, $list)) . " is fronting this week."; } elseif (count($list) > 0) { - $str = (getMemberWithoutSystem($list[0])["display_name"] ?? getMemberWithoutSystem($list[0])["name"]) . " is fronting today."; + $str = (getMemberWithoutSystem($list[0])["display_name"] ?? getMemberWithoutSystem($list[0])["name"]) . " is fronting this week."; } else { - $str = "We couldn't tell who will front today, sorry."; + $str = "We couldn't tell who will front this week, sorry."; } $context = stream_context_create([ @@ -154,7 +162,7 @@ $context = stream_context_create([ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🎠 Pony fronting today") . "\r\n" . + "Title: " . formatPonypush("🎛️ Pony fronting this week") . "\r\n" . "Priority: high\r\n" . "Tags: schedule\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), |