compute/add total hours column
This commit is contained in:
parent
f4d60098e1
commit
7e2ffb3e24
@ -83,7 +83,7 @@ class Window:
|
||||
self.projects_table.attach(gtk.Label(pname), 0, 1,
|
||||
row, row + 1)
|
||||
self.project_hour_labels[pnum] = {}
|
||||
for i in range(7):
|
||||
for i in range(8):
|
||||
l = gtk.Label()
|
||||
self.projects_table.attach(l, i + 1, i + 2, row, row + 1)
|
||||
self.project_hour_labels[pnum][i] = l
|
||||
@ -118,13 +118,20 @@ class Window:
|
||||
self.updateProjectHours()
|
||||
|
||||
def updateProjectHours(self):
|
||||
totals = {}
|
||||
for day in range(7):
|
||||
dt = str(self.monday + timedelta(day))
|
||||
day_hours = self.ds.getProjectDailyHours(dt)
|
||||
for p in day_hours:
|
||||
if p in self.project_hour_labels:
|
||||
hrs = self.hoursFromSeconds(day_hours[p])
|
||||
if not p in totals:
|
||||
totals[p] = 0
|
||||
totals[p] += float(hrs)
|
||||
self.project_hour_labels[p][day].set_text(hrs)
|
||||
for p in totals:
|
||||
if p in self.project_hour_labels:
|
||||
self.project_hour_labels[p][7].set_text(str(totals[p]))
|
||||
|
||||
def getProjectWeekHours(self):
|
||||
proj_week_hours = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user