Fix docstring and use "Couldn't" instead of "Failed"

This commit is contained in:
2022-08-14 13:47:12 +02:00
parent 35e47115b8
commit 3f8be91e09

View File

@ -1,3 +1,6 @@
"""
calculate(job) - Calculates how many days, hours and minutes till trigger.
"""
import datetime import datetime
import pytz import pytz
@ -17,7 +20,7 @@ def calculate(job: Job) -> str:
job: The job. Can be cron, interval or normal. job: The job. Can be cron, interval or normal.
Returns: Returns:
Returns days, hours and minutes till reminder. Returns "Failed to calculate time" if no job is found. Returns days, hours and minutes till the reminder. Returns "Couldn't calculate time" if no job is found.
""" """
# TODO: This "breaks" when only seconds are left. # TODO: This "breaks" when only seconds are left.
# If we use (in {calc_countdown(job)}) it will show (in ) # If we use (in {calc_countdown(job)}) it will show (in )
@ -27,10 +30,10 @@ def calculate(job: Job) -> str:
else: else:
trigger_time = job.next_run_time 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:
# TODO: Change this to None and send this text where needed. # TODO: Change this to None and send this text where needed.
return "Failed to calculate time" return "Couldn't calculate time"
# Get time and date the job will run and calculate how many days, # Get time and date the job will run and calculate how many days,
# hours and seconds. # hours and seconds.