Skip to content

Commit 46cd510

Browse files
committed
Add more type hints and comments
1 parent 91f352d commit 46cd510

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def add_task() -> Response: # add the task to the task list
222222

223223
@app.route("/complete_task/<int:task_id>")
224224
def complete_task(task_id) -> Response: # complete task from task id
225-
task = Task.query.get(task_id) # get task by task id
225+
task: Union[Task, None] = Task.query.get(task_id) # get task by task id
226226
if task: # if task exists
227227
due_multiplier: float = 1.0 # set default due multiplier to 1
228228
if task.repeat_often == 5: # if the task is a one-time task
@@ -370,7 +370,7 @@ def complete_task(task_id) -> Response: # complete task from task id
370370
@app.route("/delete_task/<int:task_id>")
371371
def delete_task(task_id) -> Response: # delete task from task id
372372
task: Union[Task, None] = Task.query.get(task_id) # get task by task id
373-
if task:
373+
if task: # if task exists
374374
db.session.delete(task) # delete task from task list
375375
db.session.commit() # commit database changes
376376
return redirect(url_for("index")) # redirect to index page template
@@ -404,7 +404,7 @@ def calculate_next_recurring_event(
404404
) # add months to the original date
405405
elif repeat_often == 4: # if task repeat often is yearly
406406
new_year = original_date.year + repeat_interval * times_completed
407-
max_days_in_month = calendar.monthrange(new_year, original_date.month)[
407+
max_days_in_month: int = calendar.monthrange(new_year, original_date.month)[
408408
1
409409
] # get number of days in month
410410
return date(

0 commit comments

Comments
 (0)