added DataStore.getTaskByName(), strip task names
This commit is contained in:
parent
70e687afca
commit
64428ab99e
13
DataStore.py
13
DataStore.py
@ -102,6 +102,7 @@ WHERE id = ?
|
|||||||
def getTaskByNameParent(self, name, parentid):
|
def getTaskByNameParent(self, name, parentid):
|
||||||
t = None
|
t = None
|
||||||
c = self.conn.cursor()
|
c = self.conn.cursor()
|
||||||
|
name = name.strip()
|
||||||
if parentid is None:
|
if parentid is None:
|
||||||
c.execute('''
|
c.execute('''
|
||||||
SELECT id, name, longname, parentid
|
SELECT id, name, longname, parentid
|
||||||
@ -120,6 +121,18 @@ WHERE name = ? AND parentid = ?
|
|||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
def getTaskByName(self, name):
|
||||||
|
parts = name.split(':')
|
||||||
|
parentid = None
|
||||||
|
task = None
|
||||||
|
for p in parts:
|
||||||
|
p = p.strip()
|
||||||
|
task = self.getTaskByNameParent(p, parentid)
|
||||||
|
if task is None:
|
||||||
|
break
|
||||||
|
parentid = task.taskid
|
||||||
|
return task
|
||||||
|
|
||||||
def createTask(self, name, longname, parentid):
|
def createTask(self, name, longname, parentid):
|
||||||
c = self.conn.cursor()
|
c = self.conn.cursor()
|
||||||
if parentid is not None and parentid != '':
|
if parentid is not None and parentid != '':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user