added DataStore.getDailyHours()
This commit is contained in:
parent
b24dcf4bad
commit
a9442457f3
21
DataStore.py
21
DataStore.py
@ -110,3 +110,24 @@ FROM %s
|
|||||||
nextid = row[0] + 1
|
nextid = row[0] + 1
|
||||||
c.close()
|
c.close()
|
||||||
return nextid
|
return nextid
|
||||||
|
|
||||||
|
def getDailyHours(self, date):
|
||||||
|
hours = {}
|
||||||
|
c = self.conn.cursor()
|
||||||
|
c.execute('''
|
||||||
|
SELECT projects.id, tasks.id, hours.seconds
|
||||||
|
FROM projects, tasks, hours
|
||||||
|
WHERE hours.date = ?
|
||||||
|
AND hours.taskid = tasks.id
|
||||||
|
AND tasks.projectid = projects.id
|
||||||
|
''', (date,))
|
||||||
|
for row in c:
|
||||||
|
pid, tid, secs = row
|
||||||
|
if not pid in hours:
|
||||||
|
hours[pid] = {}
|
||||||
|
if not tid in hours[pid]:
|
||||||
|
hours[pid] = {}
|
||||||
|
hours[pid][tid] = secs
|
||||||
|
c.close()
|
||||||
|
self.conn.commit()
|
||||||
|
return hours
|
||||||
|
Loading…
x
Reference in New Issue
Block a user