1
0
Fork 0

fix: remove any alarm given an action

Signed-off-by: thiswillbeyourgithub <github@32mail.33mail.com>
This commit is contained in:
thiswillbeyourgithub 2023-07-07 20:03:17 +02:00 committed by Daniel Thompson
parent 1ad2ee1d66
commit 81e38a85b0

View file

@ -350,13 +350,13 @@ class Manager():
def cancel_alarm(self, time, action): def cancel_alarm(self, time, action):
"""Unqueue an alarm.""" """Unqueue an alarm."""
alarms = self._alarms
try: try:
if time is None: if not time:
for i, al in enumerate(self._alarms): time_to_remove = [al[0] for al in alarms if al[1] == action]
if self._alarms[i][1] == action: [alarms.remove((t, action)) for t in time_to_remove]
self._alarms.remove(self._alarms[i])
else: else:
self._alarms.remove((time, action)) alarms.remove((time, action))
except: except:
return False return False
return True return True