add getProjectWeekHours()

show project rows that have hours by default
This commit is contained in:
Josh Holtrop 2011-02-25 21:12:49 -05:00
parent 96e018e308
commit f4d60098e1

View File

@ -59,6 +59,9 @@ class Window:
projects_to_show = {}
for p in self.shown_projects:
projects_to_show[p] = 1
project_week_hours = self.getProjectWeekHours()
for p in project_week_hours:
projects_to_show[p] = 1
# Header row
col_headers = ('Project',
@ -123,6 +126,17 @@ class Window:
hrs = self.hoursFromSeconds(day_hours[p])
self.project_hour_labels[p][day].set_text(hrs)
def getProjectWeekHours(self):
proj_week_hours = {}
for day in range(7):
dt = str(self.monday + timedelta(day))
day_hours = self.ds.getProjectDailyHours(dt)
for p in day_hours:
if not p in proj_week_hours:
proj_week_hours[p] = 0
proj_week_hours[p] += float(day_hours[p])
return proj_week_hours
def hoursFromSeconds(self, secs):
if secs < 0.01 * 60 * 60:
secs = 0.01 * 60 * 60;