From 9145acf5e7870c05e56719211e6b6a2407f662e7 Mon Sep 17 00:00:00 2001 From: Wouter Horlings Date: Tue, 19 Nov 2019 16:50:58 +0100 Subject: [PATCH] updated the notification message and added more documentation --- myTodoist.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/myTodoist.py b/myTodoist.py index c324507..fefca02 100644 --- a/myTodoist.py +++ b/myTodoist.py @@ -25,9 +25,14 @@ def fromisoformat(datestr): else: return None +##@class TodoProject +# @brief functions to load a single or all projects and has methods to check the state of the project class TodoProject: ''' Common class for api calls''' +##@brief constructor of class +# tries to load api-token from apikey-file. +# @param project String with project name or integer with project_id def __init__(self,project=None): fh_api = open("apikey","r") self.apikey = fh_api.read() @@ -48,8 +53,9 @@ class TodoProject: return self.api.sync() def checktaskstoday(self,tasklimit): - if len(self.items.itemsForDay()) < tasklimit: - self.sendnotification("TASKS","Not enough Tasks Scheduled for today!") + numOfItems = len(self.items.itemsForDay()) + if numOfItems < tasklimit: + self.sendnotification("TASKS","Not enough Tasks Scheduled for today!\n" + "Only " + str(numOfItems) + " of " + str(tasklimit) + " tasks set!" ) def checkTasksWithoutNotes(self,date=date.today()): if len(self.items.itemsClosedWithoutNotes())>0: @@ -126,6 +132,16 @@ class TodoItemList: _items.append(item) return _items + ##@brief get all items that are due for specified day and not closed yet. + # @_date date-object to specify the search day. Defaults to today. + # @return list of items that have a duedate as specified in _date and are still open. + def pendingItemsForDay(self,_date=date.today()): + _items = [] + for item in self.items: + if item.dueOnDate(_date) and not item.checked: + _items.append(item) + return _items + ##@brief get all items that closed but do not have notes attached to them # @return list of closed items that do not have notes attached. def itemsClosedWithoutNotes(self):