Uncomplicate if else

This commit is contained in:
2022-03-18 01:33:48 +01:00
parent 625f1d4f1a
commit 76cf3b52e9

View File

@ -41,9 +41,10 @@ def calc_countdown(job) -> str:
str: Returns days, hours and minutes till reminder. Returns str: Returns days, hours and minutes till reminder. Returns
"Failed to calculate time" if no job is found. "Failed to calculate time" if no job is found.
""" """
trigger_time = ( if type(job.trigger) is DateTrigger:
job.trigger.run_date if type(job.trigger) is DateTrigger else job.next_run_time trigger_time = job.trigger.run_date
) else:
trigger_time = job.next_run_time
# Get_job() returns None when it can't find a job with that id. # Get_job() returns None when it can't find a job with that id.
if trigger_time is None: if trigger_time is None: