Added update of task table cells with hours

This commit is contained in:
AndrewButer 2011-03-18 13:39:42 -04:00
parent f73f92c147
commit 6b484c1308

View File

@ -189,6 +189,7 @@ class Window:
self.projects_table.show_all() self.projects_table.show_all()
self.updateProjectHours() self.updateProjectHours()
self.updateTaskHours()
def updateProjectHours(self): def updateProjectHours(self):
totals = {} totals = {}
@ -206,6 +207,23 @@ class Window:
if p in self.project_hour_labels: if p in self.project_hour_labels:
self.project_hour_labels[p][7].set_text(str(totals[p])) self.project_hour_labels[p][7].set_text(str(totals[p]))
def updateTaskHours(self):
totals = {}
for day in range(7):
dt = str(self.monday + timedelta(day))
day_hours = self.ds.getDailyHours(dt)
if self.currProject in day_hours:
for t in day_hours[self.currProject]:
if t in self.task_hour_labels:
hrs = self.hoursFromSeconds(day_hours[self.currProject][t])
if not t in totals:
totals[t] = 0
totals[t] += float(hrs)
self.task_hour_labels[t][day].set_text(hrs)
for t in totals:
if t in self.task_hour_labels:
self.task_hour_labels[t][7].set_text(str(totals[t]))
def getProjectWeekHours(self): def getProjectWeekHours(self):
proj_week_hours = {} proj_week_hours = {}
for day in range(7): for day in range(7):